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 echo($sum(5, 10)); // 116 echo($sum(5, 10)); // 117 outer(); // redefine sum at the global scope and print 100 echo($sum(5, 10)); // 116 echo($sum(5, 10)); // 117
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/m8Vf5
function name:  (null)
number of ops:  25
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_DYNAMIC_CALL                                        !0
          3        SEND_VAL_EX                                              5
          4        SEND_VAL_EX                                              10
          5        DO_FCALL                                      0  $2      
          6        ECHO                                                     $2
   14     7        INIT_DYNAMIC_CALL                                        !0
          8        SEND_VAL_EX                                              5
          9        SEND_VAL_EX                                              10
         10        DO_FCALL                                      0  $3      
         11        ECHO                                                     $3
   15    12        INIT_FCALL                                               'outer'
         13        DO_FCALL                                      0          
   16    14        INIT_DYNAMIC_CALL                                        !0
         15        SEND_VAL_EX                                              5
         16        SEND_VAL_EX                                              10
         17        DO_FCALL                                      0  $5      
         18        ECHO                                                     $5
   17    19        INIT_DYNAMIC_CALL                                        !0
         20        SEND_VAL_EX                                              5
         21        SEND_VAL_EX                                              10
         22        DO_FCALL                                      0  $6      
         23        ECHO                                                     $6
         24      > RETURN                                                   1

Function outer:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/m8Vf5
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%2Fm8Vf5%3A7%240'
          2        ASSIGN                                                   !1, ~3
   10     3        ECHO                                                     !0
   11     4      > RETURN                                                   null

End of function outer

Function %00%7Bclosure%7D%2Fin%2Fm8Vf5%3A7%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/m8Vf5
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%2Fm8Vf5%3A7%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.7 ms | 1403 KiB | 15 Q