开发者

ordering array keys?

i want to create an array with 2 keys and i want them in following order:

$array['higher'];
$array['escalate'];

how could i accomplish this without creating any value.

i want to add values to the array with later on...

$array['higher'][] = 'some_value';
$array['escalate'][] = 'some_value';

...but fi开发者_Go百科rst i need to create the keys in that order.

thanks in advance!


I think there's no easier way than

$array = array("higher" => null, "escalate" => null);


You can simply define it without adding values

$array['A'] = NULL;
$array['B'] = NULL;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜