3v4l.org

run code in 300+ PHP versions simultaneously
<?php function _object_to_array_batch($object) { return $object; } function set_insert_batch($key) { $key = _object_to_array_batch($key); var_dump(current($key)); } function insert_batch($object) { set_insert_batch($object); } function test_walk() { $foo = [ ['a' => 'hao', 'language' =>'US'], ['a' => 'buhao', 'language' =>'CN'], ]; array_walk($foo, function(&$item, $key, $parent_id) {$item['parent_id'] = $parent_id;}, 123); var_dump(current($foo)); insert_batch($foo); } test_walk();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kgkll
function name:  (null)
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   INIT_FCALL                                               'test_walk'
          1        DO_FCALL                                      0          
          2      > RETURN                                                   1

Function _object_to_array_batch:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kgkll
function name:  _object_to_array_batch
number of ops:  3
compiled vars:  !0 = $object
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    4     1      > RETURN                                                   !0
    5     2*     > RETURN                                                   null

End of function _object_to_array_batch

Function set_insert_batch:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kgkll
function name:  set_insert_batch
number of ops:  12
compiled vars:  !0 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    9     1        INIT_FCALL                                               '_object_to_array_batch'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $1      
          4        ASSIGN                                                   !0, $1
   10     5        INIT_FCALL                                               'var_dump'
          6        INIT_FCALL                                               'current'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $3      
          9        SEND_VAR                                                 $3
         10        DO_ICALL                                                 
   11    11      > RETURN                                                   null

End of function set_insert_batch

Function insert_batch:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kgkll
function name:  insert_batch
number of ops:  5
compiled vars:  !0 = $object
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   15     1        INIT_FCALL                                               'set_insert_batch'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0          
   16     4      > RETURN                                                   null

End of function insert_batch

Function test_walk:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kgkll
function name:  test_walk
number of ops:  17
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   ASSIGN                                                   !0, <array>
   24     1        INIT_FCALL                                               'array_walk'
          2        SEND_REF                                                 !0
          3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fkgkll%3A24%240'
          4        SEND_VAL                                                 ~2
          5        SEND_VAL                                                 123
          6        DO_ICALL                                                 
   26     7        INIT_FCALL                                               'var_dump'
          8        INIT_FCALL                                               'current'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $4      
         11        SEND_VAR                                                 $4
         12        DO_ICALL                                                 
   28    13        INIT_FCALL                                               'insert_batch'
         14        SEND_VAR                                                 !0
         15        DO_FCALL                                      0          
   29    16      > RETURN                                                   null

End of function test_walk

Function %00%7Bclosure%7D%2Fin%2Fkgkll%3A24%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kgkll
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $item, !1 = $key, !2 = $parent_id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        ASSIGN_DIM                                               !0, 'parent_id'
          4        OP_DATA                                                  !2
          5      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fkgkll%3A24%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.8 ms | 1403 KiB | 23 Q