3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test() { static $i; if (!isset($i)) $i = 3; if ($i <= 0) return; $i--; return array('id' => mt_rand(), 'iteration' => $i); } $rappels = array(); $i = 0; while($row = test()) { foreach($row as $key=>$val) { $rappels[$i][$key] = $val; } $i++; } 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 = 62) Position 1 = -2
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/Gf3fn
function name:  (null)
number of ops:  20
compiled vars:  !0 = $rappels, !1 = $i, !2 = $row, !3 = $val, !4 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   ASSIGN                                                   !0, <array>
   16     1        ASSIGN                                                   !1, 0
   17     2      > JMP                                                      ->12
   18     3    > > FE_RESET_R                                       $7      !2, ->10
          4    > > FE_FETCH_R                                       ~8      $7, !3, ->10
          5    >   ASSIGN                                                   !4, ~8
   19     6        FETCH_DIM_W                                      $10     !0, !1
          7        ASSIGN_DIM                                               $10, !4
          8        OP_DATA                                                  !3
   18     9      > JMP                                                      ->4
         10    >   FE_FREE                                                  $7
   21    11        PRE_INC                                                  !1
   17    12    >   INIT_FCALL                                               'test'
         13        DO_FCALL                                      0  $13     
         14        ASSIGN                                           ~14     !2, $13
         15      > JMPNZ                                                    ~14, ->3
   23    16    >   INIT_FCALL                                               'var_dump'
         17        SEND_VAR                                                 !0
         18        DO_ICALL                                                 
         19      > RETURN                                                   1

Function test:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 8
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
filename:       /in/Gf3fn
function name:  test
number of ops:  15
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   BIND_STATIC                                              !0
    5     1        ISSET_ISEMPTY_CV                                 ~1      !0
          2        BOOL_NOT                                         ~2      ~1
          3      > JMPZ                                                     ~2, ->5
    6     4    >   ASSIGN                                                   !0, 3
    8     5    >   IS_SMALLER_OR_EQUAL                                      !0, 0
          6      > JMPZ                                                     ~4, ->8
    9     7    > > RETURN                                                   null
   11     8    >   PRE_DEC                                                  !0
   12     9        INIT_FCALL                                               'mt_rand'
         10        DO_ICALL                                         $6      
         11        INIT_ARRAY                                       ~7      $6, 'id'
         12        ADD_ARRAY_ELEMENT                                ~7      !0, 'iteration'
         13      > RETURN                                                   ~7
   13    14*     > RETURN                                                   null

End of function test

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.93 ms | 1403 KiB | 18 Q