3v4l.org

run code in 300+ PHP versions simultaneously
<?php $sum; // global variable function outer() { $hundred_more = 100; $sum = function ($a, $b) { return $a + $b + (++$hundred_more); }; echo $hundred_more; } outer(); // define sum at the global scope and print 100 alert($sum(5, 10)); // 116 alert($sum(5, 10)); // 117 outer(); // redefine sum at the global scope and print 100 alert($sum(5, 10)); // 116 alert($sum(5, 10)); // 117
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4lZWP
function name:  (null)
number of ops:  33
compiled vars:  !0 = $sum
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'outer'
          1        DO_FCALL                                      0          
   13     2        INIT_FCALL_BY_NAME                                       'alert'
          3        INIT_DYNAMIC_CALL                                        !0
          4        SEND_VAL_EX                                              5
          5        SEND_VAL_EX                                              10
          6        DO_FCALL                                      0  $2      
          7        SEND_VAR_NO_REF_EX                                       $2
          8        DO_FCALL                                      0          
   14     9        INIT_FCALL_BY_NAME                                       'alert'
         10        INIT_DYNAMIC_CALL                                        !0
         11        SEND_VAL_EX                                              5
         12        SEND_VAL_EX                                              10
         13        DO_FCALL                                      0  $4      
         14        SEND_VAR_NO_REF_EX                                       $4
         15        DO_FCALL                                      0          
   15    16        INIT_FCALL                                               'outer'
         17        DO_FCALL                                      0          
   16    18        INIT_FCALL_BY_NAME                                       'alert'
         19        INIT_DYNAMIC_CALL                                        !0
         20        SEND_VAL_EX                                              5
         21        SEND_VAL_EX                                              10
         22        DO_FCALL                                      0  $7      
         23        SEND_VAR_NO_REF_EX                                       $7
         24        DO_FCALL                                      0          
   17    25        INIT_FCALL_BY_NAME                                       'alert'
         26        INIT_DYNAMIC_CALL                                        !0
         27        SEND_VAL_EX                                              5
         28        SEND_VAL_EX                                              10
         29        DO_FCALL                                      0  $9      
         30        SEND_VAR_NO_REF_EX                                       $9
         31        DO_FCALL                                      0          
         32      > RETURN                                                   1

Function outer:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4lZWP
function name:  outer
number of ops:  5
compiled vars:  !0 = $hundred_more, !1 = $sum
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   ASSIGN                                                   !0, 100
    7     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F4lZWP%3A7%240'
          2        ASSIGN                                                   !1, ~3
   10     3        ECHO                                                     !0
   11     4      > RETURN                                                   null

End of function outer

Function %00%7Bclosure%7D%2Fin%2F4lZWP%3A7%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4lZWP
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $a, !1 = $b, !2 = $hundred_more
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    8     2        ADD                                              ~3      !0, !1
          3        PRE_INC                                          ~4      !2
          4        ADD                                              ~5      ~3, ~4
          5      > RETURN                                                   ~5
    9     6*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F4lZWP%3A7%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.58 ms | 1403 KiB | 15 Q