3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test($reset = FALSE) { static $i; if ($reset) { $i = -1; return; } if (!isset($i) || $i = -1) $i = 3; if ($i <= 0) return; return array('id' => $i--, 'someValue' => mt_rand()); } $rappels = array(); $i = 0; while($row = test()) { foreach($row as $key=>$val) { $rappels[$i][$key] = $val; } $i++; } var_dump($rappels); test(TRUE); $rappels = array(); while($row = test()) { $rappels[] = $row; } var_dump($rappels);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 3
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 24
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 24
Branch analysis from position: 30
Branch analysis from position: 24
Branch analysis from position: 3
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 10
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 10
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 3
Branch analysis from position: 16
Branch analysis from position: 3
Branch analysis from position: 10
filename:       /in/N5JgI
function name:  (null)
number of ops:  34
compiled vars:  !0 = $rappels, !1 = $i, !2 = $row, !3 = $val, !4 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   ASSIGN                                                   !0, <array>
   19     1        ASSIGN                                                   !1, 0
   20     2      > JMP                                                      ->12
   21     3    > > FE_RESET_R                                       $7      !2, ->10
          4    > > FE_FETCH_R                                       ~8      $7, !3, ->10
          5    >   ASSIGN                                                   !4, ~8
   22     6        FETCH_DIM_W                                      $10     !0, !1
          7        ASSIGN_DIM                                               $10, !4
          8        OP_DATA                                                  !3
   21     9      > JMP                                                      ->4
         10    >   FE_FREE                                                  $7
   24    11        PRE_INC                                                  !1
   20    12    >   INIT_FCALL                                               'test'
         13        DO_FCALL                                      0  $13     
         14        ASSIGN                                           ~14     !2, $13
         15      > JMPNZ                                                    ~14, ->3
   26    16    >   INIT_FCALL                                               'var_dump'
         17        SEND_VAR                                                 !0
         18        DO_ICALL                                                 
   28    19        INIT_FCALL                                               'test'
         20        SEND_VAL                                                 <true>
         21        DO_FCALL                                      0          
   30    22        ASSIGN                                                   !0, <array>
   31    23      > JMP                                                      ->26
   32    24    >   ASSIGN_DIM                                               !0
         25        OP_DATA                                                  !2
   31    26    >   INIT_FCALL                                               'test'
         27        DO_FCALL                                      0  $19     
         28        ASSIGN                                           ~20     !2, $19
         29      > JMPNZ                                                    ~20, ->24
   34    30    >   INIT_FCALL                                               'var_dump'
         31        SEND_VAR                                                 !0
         32        DO_ICALL                                                 
         33      > RETURN                                                   1

Function test:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 47) Position 1 = 8, Position 2 = 10
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 12
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 15
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
Branch analysis from position: 10
filename:       /in/N5JgI
function name:  test
number of ops:  22
compiled vars:  !0 = $reset, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV_INIT                                        !0      <false>
    4     1        BIND_STATIC                                              !1
    5     2      > JMPZ                                                     !0, ->5
    6     3    >   ASSIGN                                                   !1, -1
    7     4      > RETURN                                                   null
    9     5    >   ISSET_ISEMPTY_CV                                 ~3      !1
          6        BOOL_NOT                                         ~4      ~3
          7      > JMPNZ_EX                                         ~4      ~4, ->10
          8    >   ASSIGN                                           ~5      !1, -1
          9        BOOL                                             ~4      ~5
         10    > > JMPZ                                                     ~4, ->12
   10    11    >   ASSIGN                                                   !1, 3
   12    12    >   IS_SMALLER_OR_EQUAL                                      !1, 0
         13      > JMPZ                                                     ~7, ->15
   13    14    > > RETURN                                                   null
   15    15    >   POST_DEC                                         ~8      !1
         16        INIT_ARRAY                                       ~9      ~8, 'id'
         17        INIT_FCALL                                               'mt_rand'
         18        DO_ICALL                                         $10     
         19        ADD_ARRAY_ELEMENT                                ~9      $10, 'someValue'
         20      > RETURN                                                   ~9
   16    21*     > RETURN                                                   null

End of function test

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.35 ms | 1394 KiB | 20 Q