3v4l.org

run code in 300+ PHP versions simultaneously
<?php $count = 0; $addone = function() use ($count) { $count ++; }; echo 'Broken:'; echo $count . "<br>"; $addone(); $addone(); echo $count. "<br>"; $addonefix = function() use (&$count) { $count ++; }; echo 'With Fix:'; echo $count. "<br>"; $addonefix(); $addonefix(); echo $count. "<br>";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mQGfK
function name:  (null)
number of ops:  26
compiled vars:  !0 = $count, !1 = $addone, !2 = $addonefix
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 0
    4     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FmQGfK%3A4%240'
          2        BIND_LEXICAL                                             ~4, !0
          3        ASSIGN                                                   !1, ~4
    9     4        ECHO                                                     'Broken%3A'
   10     5        CONCAT                                           ~6      !0, '%3Cbr%3E'
          6        ECHO                                                     ~6
   11     7        INIT_DYNAMIC_CALL                                        !1
          8        DO_FCALL                                      0          
   12     9        INIT_DYNAMIC_CALL                                        !1
         10        DO_FCALL                                      0          
   13    11        CONCAT                                           ~9      !0, '%3Cbr%3E'
         12        ECHO                                                     ~9
   15    13        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FmQGfK%3A15%241'
         14        BIND_LEXICAL                                             ~10, !0
         15        ASSIGN                                                   !2, ~10
   19    16        ECHO                                                     'With+Fix%3A'
   20    17        CONCAT                                           ~12     !0, '%3Cbr%3E'
         18        ECHO                                                     ~12
   21    19        INIT_DYNAMIC_CALL                                        !2
         20        DO_FCALL                                      0          
   22    21        INIT_DYNAMIC_CALL                                        !2
         22        DO_FCALL                                      0          
   23    23        CONCAT                                           ~15     !0, '%3Cbr%3E'
         24        ECHO                                                     ~15
         25      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FmQGfK%3A4%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mQGfK
function name:  {closure}
number of ops:  3
compiled vars:  !0 = $count
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   BIND_STATIC                                              !0
    7     1        PRE_INC                                                  !0
    8     2      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FmQGfK%3A4%240

Function %00%7Bclosure%7D%2Fin%2FmQGfK%3A15%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mQGfK
function name:  {closure}
number of ops:  3
compiled vars:  !0 = $count
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   BIND_STATIC                                              !0
   17     1        PRE_INC                                                  !0
   18     2      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FmQGfK%3A15%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.7 ms | 1395 KiB | 13 Q