-2
<?php $mypeople=array("age"=>23,"fname"=>"sami","family"=>"soheili","job"=>"Dev", "father" => array("age" => 66
, "name" => "fara"
, "family" => "soheili"
, "job" => "clerk")); ?>
我知道這種方式編碼數組中的數組,但我怎麼可以使用它[]
呢?如何在PHP中創建嵌套數組?
例如:
<?php $myarr=["name"=>"sami","family"=>"soheili"]
我想使[ ]
內的另一個數組,這可能嗎? (不使用array()
)
'[]'是用於在PHP 5.4引入陣列的短符號的語法。閱讀更多關於[PHP數組](http://php.net/manual/en/language.types.array.php) – axiac