php - PHPDoc - Specify the type of array keys -
php - PHPDoc - Specify the type of array keys -
how can specify type of keys in documentation of php method returns array?
for example, utilize array of objects @return myclass[]
.
but want comment array array( 'string' => array( myclass ) )
, possible?
why need specify datatype. can access values in array using foreach loop trough results.
for example:
$arr = array("name" => "miko", "street" => "straatnaam", "number" => "2"); //here key first key, in case: name, street, number //and value values of keys, in case: miko, straatnaam, 2 foreach($arr $key => $value) { echo $key." ".$value."<br/>"; }
you can extract specific info out of using this:
echo $arr['name'];
if want go object:
foreach($arr $objname => $objcontent) { foreach($objcontent $objnodename => $objnodevalue) { echo $objnodename." = ".$objnodevalue; } }
php arrays phpdoc
Comments
Post a Comment