3v4l.org

run code in 300+ PHP versions simultaneously
<?php function evaluator(callable $yielder) { foreach ($yielder() as $value) { if ($value) { break; } } var_dump($value); } evaluator(function () { var_dump(1); yield false; var_dump(2); yield false; var_dump(3); yield true; var_dump(4); yield false; var_dump(5); yield true; });
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OqXGZ
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_FCALL                                               'evaluator'
          1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FOqXGZ%3A15%240'
   26     2        SEND_VAL                                                 ~0
          3        DO_FCALL                                      0          
          4      > RETURN                                                   1

Function evaluator:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 8
Branch analysis from position: 8
filename:       /in/OqXGZ
function name:  evaluator
number of ops:  13
compiled vars:  !0 = $yielder, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        INIT_DYNAMIC_CALL                                        !0
          2        DO_FCALL                                      0  $2      
          3      > FE_RESET_R                                       $3      $2, ->8
          4    > > FE_FETCH_R                                               $3, !1, ->8
    7     5    > > JMPZ                                                     !1, ->7
    9     6    > > JMP                                                      ->8
    5     7    > > JMP                                                      ->4
          8    >   FE_FREE                                                  $3
   12     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                                 
   13    12      > RETURN                                                   null

End of function evaluator

Function %00%7Bclosure%7D%2Fin%2FOqXGZ%3A15%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/OqXGZ
function name:  {closure}
number of ops:  22
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   GENERATOR_CREATE                                         
   16     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAL                                                 1
          3        DO_ICALL                                                 
   17     4        YIELD                                                    <false>
   18     5        INIT_FCALL                                               'var_dump'
          6        SEND_VAL                                                 2
          7        DO_ICALL                                                 
   19     8        YIELD                                                    <false>
   20     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAL                                                 3
         11        DO_ICALL                                                 
   21    12        YIELD                                                    <true>
   22    13        INIT_FCALL                                               'var_dump'
         14        SEND_VAL                                                 4
         15        DO_ICALL                                                 
   23    16        YIELD                                                    <false>
   24    17        INIT_FCALL                                               'var_dump'
         18        SEND_VAL                                                 5
         19        DO_ICALL                                                 
   25    20        YIELD                                                    <true>
   26    21      > GENERATOR_RETURN                                         

End of function %00%7Bclosure%7D%2Fin%2FOqXGZ%3A15%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.32 ms | 1403 KiB | 16 Q