3v4l.org

run code in 500+ 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                              ~12     [0]
   23    20        SEND_VAL                                                     ~12
         21        INIT_ARRAY                                           ~13     !0
         22        SEND_VAL                                                     ~13
   13    23        DO_ICALL                                             $14     
         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                              ~20     [1]
   41    34        SEND_VAL                                                     ~20
         35        INIT_ARRAY                                           ~21     !0
         36        SEND_VAL                                                     ~21
   29    37        DO_ICALL                                             $22     
         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


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

End of Dynamic Function 0

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

End of Dynamic Function 1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
175.94 ms | 3390 KiB | 16 Q