3v4l.org

run code in 300+ PHP versions simultaneously
<?php $ll = new SplDoublyLinkedList(); $ll->push('ze'); $ll->push('ome'); $ll->push('yei'); $ll->push('nahui'); $ll->rewind(); // HHVM works fine $iterations_done = iterator_apply($ll, function(Iterator $it) { echo implode("\t=>", array( $it->key(), $it->current(), ucfirst($it->current()) )),"\n"; return true; }, array($ll)); echo "Did iterate {$iterations_done} times \n"; $ll->rewind(); $iterations_done = iterator_apply($ll, function(Iterator $it) { echo implode("\t=>", array( $it->key(), $it->current(), ucfirst($it->current()) )),"\n"; $it->next(); return true; }, array($ll)); echo "Did iterate {$iterations_done} times \n"; $ll->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO | SplDoublyLinkedList::IT_MODE_DELETE); var_dump($ll->count()); foreach($ll as $key => $val) { echo "{$key}\t",ucfirst($val),"\n"; } var_dump($ll->count());
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 52, Position 2 = 63
Branch analysis from position: 52
2 jumps found. (Code = 78) Position 1 = 53, Position 2 = 63
Branch analysis from position: 53
1 jumps found. (Code = 42) Position 1 = 52
Branch analysis from position: 52
Branch analysis from position: 63
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 63
filename:       /in/ARLUZ
function name:  (null)
number of ops:  70
compiled vars:  !0 = $ll, !1 = $iterations_done, !2 = $val, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $4      'SplDoublyLinkedList'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $4
    5     3        INIT_METHOD_CALL                                         !0, 'push'
          4        SEND_VAL_EX                                              'ze'
          5        DO_FCALL                                      0          
    6     6        INIT_METHOD_CALL                                         !0, 'push'
          7        SEND_VAL_EX                                              'ome'
          8        DO_FCALL                                      0          
    7     9        INIT_METHOD_CALL                                         !0, 'push'
         10        SEND_VAL_EX                                              'yei'
         11        DO_FCALL                                      0          
    8    12        INIT_METHOD_CALL                                         !0, 'push'
         13        SEND_VAL_EX                                              'nahui'
         14        DO_FCALL                                      0          
   10    15        INIT_METHOD_CALL                                         !0, 'rewind'
         16        DO_FCALL                                      0          
   13    17        INIT_FCALL                                               'iterator_apply'
         18        SEND_VAR                                                 !0
         19        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FARLUZ%3A13%240'
   23    20        SEND_VAL                                                 ~12
         21        INIT_ARRAY                                       ~13     !0
         22        SEND_VAL                                                 ~13
         23        DO_ICALL                                         $14     
   13    24        ASSIGN                                                   !1, $14
   25    25        ROPE_INIT                                     3  ~17     'Did+iterate+'
         26        ROPE_ADD                                      1  ~17     ~17, !1
         27        ROPE_END                                      2  ~16     ~17, '+times+%0A'
         28        ECHO                                                     ~16
   27    29        INIT_METHOD_CALL                                         !0, 'rewind'
         30        DO_FCALL                                      0          
   29    31        INIT_FCALL                                               'iterator_apply'
         32        SEND_VAR                                                 !0
         33        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FARLUZ%3A29%241'
   41    34        SEND_VAL                                                 ~20
         35        INIT_ARRAY                                       ~21     !0
         36        SEND_VAL                                                 ~21
         37        DO_ICALL                                         $22     
   29    38        ASSIGN                                                   !1, $22
   43    39        ROPE_INIT                                     3  ~25     'Did+iterate+'
         40        ROPE_ADD                                      1  ~25     ~25, !1
         41        ROPE_END                                      2  ~24     ~25, '+times+%0A'
         42        ECHO                                                     ~24
   45    43        INIT_METHOD_CALL                                         !0, 'setIteratorMode'
         44        SEND_VAL_EX                                              1
         45        DO_FCALL                                      0          
   47    46        INIT_FCALL                                               'var_dump'
         47        INIT_METHOD_CALL                                         !0, 'count'
         48        DO_FCALL                                      0  $28     
         49        SEND_VAR                                                 $28
         50        DO_ICALL                                                 
   49    51      > FE_RESET_R                                       $30     !0, ->63
         52    > > FE_FETCH_R                                       ~31     $30, !2, ->63
         53    >   ASSIGN                                                   !3, ~31
   50    54        NOP                                                      
         55        FAST_CONCAT                                      ~33     !3, '%09'
         56        ECHO                                                     ~33
         57        INIT_FCALL                                               'ucfirst'
         58        SEND_VAR                                                 !2
         59        DO_ICALL                                         $34     
         60        ECHO                                                     $34
         61        ECHO                                                     '%0A'
   49    62      > JMP                                                      ->52
         63    >   FE_FREE                                                  $30
   53    64        INIT_FCALL                                               'var_dump'
         65        INIT_METHOD_CALL                                         !0, 'count'
         66        DO_FCALL                                      0  $35     
         67        SEND_VAR                                                 $35
         68        DO_ICALL                                                 
         69      > RETURN                                                   1

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

End of function %00%7Bclosure%7D%2Fin%2FARLUZ%3A13%240

Function %00%7Bclosure%7D%2Fin%2FARLUZ%3A29%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ARLUZ
function name:  {closure}
number of ops:  23
compiled vars:  !0 = $it
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   RECV                                             !0      
   31     1        INIT_FCALL                                               'implode'
          2        SEND_VAL                                                 '%09%3D%3E'
   32     3        INIT_METHOD_CALL                                         !0, 'key'
          4        DO_FCALL                                      0  $1      
          5        INIT_ARRAY                                       ~2      $1
   33     6        INIT_METHOD_CALL                                         !0, 'current'
          7        DO_FCALL                                      0  $3      
          8        ADD_ARRAY_ELEMENT                                ~2      $3
   34     9        INIT_FCALL                                               'ucfirst'
         10        INIT_METHOD_CALL                                         !0, 'current'
         11        DO_FCALL                                      0  $4      
         12        SEND_VAR                                                 $4
         13        DO_ICALL                                         $5      
         14        ADD_ARRAY_ELEMENT                                ~2      $5
         15        SEND_VAL                                                 ~2
         16        DO_ICALL                                         $6      
         17        ECHO                                                     $6
   35    18        ECHO                                                     '%0A'
   37    19        INIT_METHOD_CALL                                         !0, 'next'
         20        DO_FCALL                                      0          
   39    21      > RETURN                                                   <true>
   41    22*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FARLUZ%3A29%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
177.56 ms | 1396 KiB | 21 Q