3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class C { function f($v) { $this->bar = function () use ($v) { var_dump($v); }; } } $a = new C(); $a->foo(42); $a->bar();
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/aB9Rs
function name:  (null)
number of ops:  10
compiled vars:  !0 = $a
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   2     0  E >   NOP                                                      
  10     1        NEW                                              $2      :-6
         2        DO_FCALL                                      0          
         3        ASSIGN                                                   !0, $2
  11     4        INIT_METHOD_CALL                                         !0, 'foo'
         5        SEND_VAL_EX                                              42
         6        DO_FCALL                                      0          
  12     7        INIT_METHOD_CALL                                         !0, 'bar'
         8        DO_FCALL                                      0          
         9      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FaB9Rs0x7f1939d31073:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/aB9Rs
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $v
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   4     0  E >   FETCH_R                      static              $1      'v'
         1        ASSIGN                                                   !0, $1
   5     2        INIT_FCALL                                               'var_dump'
         3        SEND_VAR                                                 !0
         4        DO_ICALL                                                 
   6     5      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FaB9Rs0x7f1939d31073

Class C:
Function f:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/aB9Rs
function name:  f
number of ops:  5
compiled vars:  !0 = $v
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   RECV                                             !0      
   4     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FaB9Rs0x7f1939d31073'
         2        ASSIGN_OBJ                                               'bar'
   6     3        OP_DATA                                                  ~2
   7     4      > RETURN                                                   null

End of function f

End of class C.

Generated using Vulcan Logic Dumper, using php 7.1.0