Given an associative array like the following,
$field_defaults = array(
'id' => 0,
'name' => 'new item',
'desc' => '',
'parent_id' => 0,
);
can I rely on array_keys()
returning the keys in the order they were specified? Or, more precisely, since arrays in PHP seem to have a stable order, as per this answer, are the keys returned by array_keys()
in the same order as they appear in the input array? The manual page doesn't give any hints.
When I try this, they seem to respect the original order, but I would like to be able to rely on that behaviour.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…