3v4l.org

run code in 300+ PHP versions simultaneously
<?php $stack = array("orange", "banana", "apple", "raspberry"); $fruit = function () use (&$stack) { return array_shift($stack); }; var_dump($fruit()); var_dump($fruit()); var_dump($fruit()); var_dump($fruit());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/54WOJ
function name:  (null)
number of ops:  25
compiled vars:  !0 = $stack, !1 = $fruit
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        DECLARE_LAMBDA_FUNCTION                          ~3      [0]
          2        BIND_LEXICAL                                             ~3, !0
          3        ASSIGN                                                   !1, ~3
    6     4        INIT_FCALL                                               'var_dump'
          5        INIT_DYNAMIC_CALL                                        !1
          6        DO_FCALL                                      0  $5      
          7        SEND_VAR                                                 $5
          8        DO_ICALL                                                 
    7     9        INIT_FCALL                                               'var_dump'
         10        INIT_DYNAMIC_CALL                                        !1
         11        DO_FCALL                                      0  $7      
         12        SEND_VAR                                                 $7
         13        DO_ICALL                                                 
    8    14        INIT_FCALL                                               'var_dump'
         15        INIT_DYNAMIC_CALL                                        !1
         16        DO_FCALL                                      0  $9      
         17        SEND_VAR                                                 $9
         18        DO_ICALL                                                 
    9    19        INIT_FCALL                                               'var_dump'
         20        INIT_DYNAMIC_CALL                                        !1
         21        DO_FCALL                                      0  $11     
         22        SEND_VAR                                                 $11
         23        DO_ICALL                                                 
         24      > 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/54WOJ
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $stack
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   BIND_STATIC                                              !0
          1        INIT_FCALL                                               'array_shift'
          2        SEND_REF                                                 !0
          3        DO_ICALL                                         $1      
          4      > RETURN                                                   $1
          5*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.22 ms | 1000 KiB | 15 Q