Multidimensional array calculations in PHP -
i have 2 arrays:
array ( [0] => stdclass object ( [id] => 1 [values] => array ( [0] => stdclass object ( [id] => 2 [field_value] => green [ordering] => 0 [count] => 0 ) [1] => stdclass object ( [id] => 1 [field_value] => red [ordering] => 1 [count] => 0 ) ... ) ) [1] => stdclass object ( [id] => 2 [values] => array ( [0] => stdclass object ( [id] => 2 [field_value] => metall [ordering] => 0 [count] => 0 ) [1] => stdclass object ( [id] => 1 [field_value] => plastic [ordering] => 1 [count] => 0 ) ... ) ) )
second array:
array ( [0] => 2 [1] => 6 [2] => 5 [3] => 3 )
and output array:
array ( [0] => stdclass object ( [id] => 1 [values] => array ( [0] => stdclass object ( [id] => 2 [field_value] => green [ordering] => 0 [count] => 2 ) [1] => stdclass object ( [id] => 1 [field_value] => red [ordering] => 1 [count] => 6 ) ... ) ) [1] => stdclass object ( [id] => 2 [values] => array ( [0] => stdclass object ( [id] => 2 [field_value] => metall [ordering] => 0 [count] => 5 ) [1] => stdclass object ( [id] => 1 [field_value] => plastic [ordering] => 1 [count] => 3 ) ... ) ) )
how can using array_map()
or array_walk_recursive()
functions?
Comments
Post a Comment