3v4l.org

run code in 300+ PHP versions simultaneously
<?php $iterator = new ArrayIterator([1, 2, 3]); $iteratorbis = new ArrayIterator([4, 5, 6]); $callable = function (Iterator $it) { echo $it->current() * 5, PHP_EOL; return true; }; iterator_apply($iterator, $callable, [$iterator]); echo "===", PHP_EOL; iterator_apply($iterator, $callable, [$iteratorbis]); echo "===", PHP_EOL; iterator_apply($iteratorbis, $callable, [$iterator]);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LYPWp
function name:  (null)
number of ops:  33
compiled vars:  !0 = $iterator, !1 = $iteratorbis, !2 = $callable
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $3      'ArrayIterator'
          1        SEND_VAL_EX                                              <array>
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $3
    4     4        NEW                                              $6      'ArrayIterator'
          5        SEND_VAL_EX                                              <array>
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $6
    6     8        DECLARE_LAMBDA_FUNCTION                          ~9      [0]
          9        ASSIGN                                                   !2, ~9
   12    10        INIT_FCALL                                               'iterator_apply'
         11        SEND_VAR                                                 !0
         12        SEND_VAR                                                 !2
         13        INIT_ARRAY                                       ~11     !0
         14        SEND_VAL                                                 ~11
         15        DO_ICALL                                                 
   13    16        ECHO                                                     '%3D%3D%3D'
         17        ECHO                                                     '%0A'
   14    18        INIT_FCALL                                               'iterator_apply'
         19        SEND_VAR                                                 !0
         20        SEND_VAR                                                 !2
         21        INIT_ARRAY                                       ~13     !1
         22        SEND_VAL                                                 ~13
         23        DO_ICALL                                                 
   15    24        ECHO                                                     '%3D%3D%3D'
         25        ECHO                                                     '%0A'
   16    26        INIT_FCALL                                               'iterator_apply'
         27        SEND_VAR                                                 !1
         28        SEND_VAR                                                 !2
         29        INIT_ARRAY                                       ~15     !0
         30        SEND_VAL                                                 ~15
         31        DO_ICALL                                                 
         32      > 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/LYPWp
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $it
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    7     1        INIT_METHOD_CALL                                         !0, 'current'
          2        DO_FCALL                                      0  $1      
          3        MUL                                              ~2      $1, 5
          4        ECHO                                                     ~2
          5        ECHO                                                     '%0A'
    8     6      > RETURN                                                   <true>
    9     7*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
259.04 ms | 1015 KiB | 14 Q