Insert new values in Sub-Arrays in PHP -


i have array this:

array(         'person0' => array( 'name'=>'name0','address'=>'address0' ),         'person1' => array( 'name'=>'name1','address'=>'address1' ),        'person2' => array( 'name'=>'name2','address'=>'address2' )       ); 

i want change this. (just append new value in each sub-array)

array(         'person0' => array( 'name'=>'name0','address'=>'address0','type'=>'type0' ),         'person1' => array( 'name'=>'name1','address'=>'address1','type'=>'type1' ),         'person2' => array( 'name'=>'name2','address'=>'address2','type'=>'type2' )       ); 

is there related function in php perform action? shortest way this. possible without loop?

thanks

browse php manual when wonder if function exists something... does.

http://www.php.net/manual/en/function.array-walk.php

http://php.net/manual/en/function.array-map.php

i'd write loop, can use functions if don't want to.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -