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

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -