3v4l.org

run code in 300+ PHP versions simultaneously
<?php $sum = null; // global variable function outer() { global $sum; $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/HuI5d
function name:  (null)
number of ops:  26
compiled vars:  !0 = $sum
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, null
   13     1        INIT_FCALL                                               'outer'
          2        DO_FCALL                                      0          
   14     3        INIT_DYNAMIC_CALL                                        !0
          4        SEND_VAL_EX                                              5
          5        SEND_VAL_EX                                              10
          6        DO_FCALL                                      0  $3      
          7        ECHO                                                     $3
   15     8        INIT_DYNAMIC_CALL                                        !0
          9        SEND_VAL_EX                                              5
         10        SEND_VAL_EX                                              10
         11        DO_FCALL                                      0  $4      
         12        ECHO                                                     $4
   16    13        INIT_FCALL                                               'outer'
         14        DO_FCALL                                      0          
   17    15        INIT_DYNAMIC_CALL                                        !0
         16        SEND_VAL_EX                                              5
         17        SEND_VAL_EX                                              10
         18        DO_FCALL                                      0  $6      
         19        ECHO                                                     $6
   18    20        INIT_DYNAMIC_CALL                                        !0
         21        SEND_VAL_EX                                              5
         22        SEND_VAL_EX                                              10
         23        DO_FCALL                                      0  $7      
         24        ECHO                                                     $7
         25      > RETURN                                                   1

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

End of function outer

Function %00%7Bclosure%7D%2Fin%2FHuI5d%3A8%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HuI5d
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
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    9     2        ADD                                              ~3      !0, !1
          3        PRE_INC                                          ~4      !2
          4        ADD                                              ~5      ~3, ~4
          5      > RETURN                                                   ~5
   10     6*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FHuI5d%3A8%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.25 ms | 1403 KiB | 15 Q