3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Thing { public function stuff() { $lambda = function() { static $y; $y++; }; var_dump(spl_object_hash($lambda)); var_dump($lambda()); } } $x = new Thing(); $x->stuff(); $x->stuff();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/k0ulB
function name:  (null)
number of ops:  8
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   NEW                                              $1      'Thing'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   15     3        INIT_METHOD_CALL                                         !0, 'stuff'
          4        DO_FCALL                                      0          
   16     5        INIT_METHOD_CALL                                         !0, 'stuff'
          6        DO_FCALL                                      0          
          7      > RETURN                                                   1

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

End of function %00%7Bclosure%7D%2Fin%2Fk0ulB%3A5%240

Class Thing:
Function stuff:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/k0ulB
function name:  stuff
number of ops:  14
compiled vars:  !0 = $lambda
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fk0ulB%3A5%240'
          1        ASSIGN                                                   !0, ~1
    9     2        INIT_FCALL                                               'var_dump'
          3        INIT_FCALL                                               'spl_object_hash'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $3      
          6        SEND_VAR                                                 $3
          7        DO_ICALL                                                 
   10     8        INIT_FCALL                                               'var_dump'
          9        INIT_DYNAMIC_CALL                                        !0
         10        DO_FCALL                                      0  $5      
         11        SEND_VAR                                                 $5
         12        DO_ICALL                                                 
   11    13      > RETURN                                                   null

End of function stuff

End of class Thing.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.39 ms | 1396 KiB | 17 Q