3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = Array ( 0 => array( 'Product' => array('id' => 21) ), 1 => array( 'Product' => array( 'id' => 43, 'children' => array( 0 => array( 'Product' => array('id' => 123) ), 1 => array( 'Product' => array('id' => 4323) ), 2 => array( 'Product' => array('id' => 3423) ) ) ) ), 2 => array( 'Product' => array('id' => 534) ) ); $keys = array_keys(array_column($array, 'id'), 123); $new_array = array_map(function($k) use ($array){return $array[$k];}, $keys); print_r($new_array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lb6O2
function name:  (null)
number of ops:  21
compiled vars:  !0 = $array, !1 = $keys, !2 = $new_array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   29     1        INIT_FCALL                                               'array_keys'
          2        INIT_FCALL                                               'array_column'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 'id'
          5        DO_ICALL                                         $4      
          6        SEND_VAR                                                 $4
          7        SEND_VAL                                                 123
          8        DO_ICALL                                         $5      
          9        ASSIGN                                                   !1, $5
   30    10        INIT_FCALL                                               'array_map'
         11        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Flb6O2%3A30%240'
         12        BIND_LEXICAL                                             ~7, !0
         13        SEND_VAL                                                 ~7
         14        SEND_VAR                                                 !1
         15        DO_ICALL                                         $8      
         16        ASSIGN                                                   !2, $8
   31    17        INIT_FCALL                                               'print_r'
         18        SEND_VAR                                                 !2
         19        DO_ICALL                                                 
         20      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Flb6O2%3A30%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lb6O2
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $k, !1 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        FETCH_DIM_R                                      ~2      !1, !0
          3      > RETURN                                                   ~2
          4*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Flb6O2%3A30%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.51 ms | 1395 KiB | 21 Q