3v4l.org

run code in 300+ PHP versions simultaneously
<?php $ll = new SplDoublyLinkedList(); $ll->push('one'); $ll->push('two'); $ll->push('three'); $ll->push('four'); $ll->rewind(); $iterations_done = iterator_apply($ll, function(Iterator $it) { echo $it->key(),"\t->", $it->current(),"\t->", ucfirst($it->current()),".\n"; $it->next(); return true; }, array($ll)); echo "Did iterate {$iterations_done} times \n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ff5j2
function name:  (null)
number of ops:  30
compiled vars:  !0 = $ll, !1 = $iterations_done
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $2      'SplDoublyLinkedList'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
    5     3        INIT_METHOD_CALL                                         !0, 'push'
          4        SEND_VAL_EX                                              'one'
          5        DO_FCALL                                      0          
    6     6        INIT_METHOD_CALL                                         !0, 'push'
          7        SEND_VAL_EX                                              'two'
          8        DO_FCALL                                      0          
    7     9        INIT_METHOD_CALL                                         !0, 'push'
         10        SEND_VAL_EX                                              'three'
         11        DO_FCALL                                      0          
    8    12        INIT_METHOD_CALL                                         !0, 'push'
         13        SEND_VAL_EX                                              'four'
         14        DO_FCALL                                      0          
   10    15        INIT_METHOD_CALL                                         !0, 'rewind'
         16        DO_FCALL                                      0          
   12    17        INIT_FCALL                                               'iterator_apply'
         18        SEND_VAR                                                 !0
         19        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fff5j2%3A12%240'
   16    20        SEND_VAL                                                 ~10
         21        INIT_ARRAY                                       ~11     !0
         22        SEND_VAL                                                 ~11
         23        DO_ICALL                                         $12     
   12    24        ASSIGN                                                   !1, $12
   17    25        ROPE_INIT                                     3  ~15     'Did+iterate+'
         26        ROPE_ADD                                      1  ~15     ~15, !1
         27        ROPE_END                                      2  ~14     ~15, '+times+%0A'
         28        ECHO                                                     ~14
         29      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Fff5j2%3A12%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ff5j2
function name:  {closure}
number of ops:  20
compiled vars:  !0 = $it
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   13     1        INIT_METHOD_CALL                                         !0, 'key'
          2        DO_FCALL                                      0  $1      
          3        ECHO                                                     $1
          4        ECHO                                                     '%09-%3E'
          5        INIT_METHOD_CALL                                         !0, 'current'
          6        DO_FCALL                                      0  $2      
          7        ECHO                                                     $2
          8        ECHO                                                     '%09-%3E'
          9        INIT_FCALL                                               'ucfirst'
         10        INIT_METHOD_CALL                                         !0, 'current'
         11        DO_FCALL                                      0  $3      
         12        SEND_VAR                                                 $3
         13        DO_ICALL                                         $4      
         14        ECHO                                                     $4
         15        ECHO                                                     '.%0A'
   14    16        INIT_METHOD_CALL                                         !0, 'next'
         17        DO_FCALL                                      0          
   15    18      > RETURN                                                   <true>
   16    19*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fff5j2%3A12%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.7 ms | 1400 KiB | 17 Q