3v4l.org

run code in 300+ PHP versions simultaneously
<?php class C implements IteratorAggregate { private int $prop = 42; public function getIterator() { return new ArrayIterator(["a"]); } } $c = new C; array_walk($c, function ($v, $k) { var_dump($v, addslashes($k)); });
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6otJZ
function name:  (null)
number of ops:  10
compiled vars:  !0 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'c'
    8     1        NEW                                              $1      'C'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
    9     4        INIT_FCALL                                               'array_walk'
          5        SEND_REF                                                 !0
          6        DECLARE_LAMBDA_FUNCTION                          ~4      [0]
          7        SEND_VAL                                                 ~4
          8        DO_ICALL                                                 
          9      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6otJZ
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $v, !1 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
          0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        INIT_FCALL                                               'var_dump'
          3        SEND_VAR                                                 !0
          4        INIT_FCALL                                               'addslashes'
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $2      
          7        SEND_VAR                                                 $2
          8        DO_ICALL                                                 
          9      > RETURN                                                   null

End of Dynamic Function 0

Class C:
Function getiterator:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6otJZ
function name:  getIterator
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   NEW                                              $0      'ArrayIterator'
          1        SEND_VAL_EX                                              <array>
          2        DO_FCALL                                      0          
          3      > RETURN                                                   $0
          4*     > RETURN                                                   null

End of function getiterator

End of class C.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.03 ms | 1001 KiB | 16 Q