3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Array representing a possible record set returned from a database $records = array( array( 'id' => "bbb", 'first_name' => 'John', 'last_name' => 'Doe', ), array( 'id' => "aaa", 'first_name' => 'Sally', 'last_name' => array( 'id' => "zzz", 'first_name' => 'Sully', 'last_name' => 'Smith', ), ), array( 'id' => "yyy", 'first_name' => 'Jane', 'last_name' => 'Jones', ), array( 'id' => "xxx", 'first_name' => 'Peter', 'last_name' => 'Doe', ) ); function test_print($val, $key, &$third) { // var_export($val); // var_export($key); // var_export($third); // $third++; if($key == 'first_name'){ $third[] = $val; } else { print_r($key); } } $third = []; array_walk_recursive($records, 'test_print', $third); print_r($third);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/J8iNU
function name:  (null)
number of ops:  11
compiled vars:  !0 = $records, !1 = $third
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, <array>
   44     1        ASSIGN                                                   !1, <array>
   45     2        INIT_FCALL                                               'array_walk_recursive'
          3        SEND_REF                                                 !0
          4        SEND_VAL                                                 'test_print'
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                                 
   46     7        INIT_FCALL                                               'print_r'
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

Function test_print:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/J8iNU
function name:  test_print
number of ops:  12
compiled vars:  !0 = $val, !1 = $key, !2 = $third
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   38     3        IS_EQUAL                                                 !1, 'first_name'
          4      > JMPZ                                                     ~3, ->8
   39     5    >   ASSIGN_DIM                                               !2
          6        OP_DATA                                                  !0
          7      > JMP                                                      ->11
   41     8    >   INIT_FCALL                                               'print_r'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                                 
   43    11    > > RETURN                                                   null

End of function test_print

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.83 ms | 1395 KiB | 17 Q