3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $callable; public function __construct() { $this->callable = function () { echo "hello world!"; }; } public function yesItDoes() { ($this->callable)(); } } class Bar { private $name; public function __construct($id) { $this->name = function ($id) { echo "Hello ".$id; }; } public function getName() { ($this->name)(); } } (new Bar('eric'))-getName(); (new Foo)->yesItDoes();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9vRuH
function name:  (null)
number of ops:  12
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   NEW                                              $0      'Bar'
          1        SEND_VAL_EX                                              'eric'
          2        DO_FCALL                                      0          
          3        INIT_FCALL_BY_NAME                                       'getName'
          4        DO_FCALL                                      0  $2      
          5        SUB                                              ~3      $0, $2
          6        FREE                                                     ~3
   30     7        NEW                                              $4      'Foo'
          8        DO_FCALL                                      0          
          9        INIT_METHOD_CALL                                         $4, 'yesItDoes'
         10        DO_FCALL                                      0          
         11      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F9vRuH%3A7%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9vRuH
function name:  {closure}
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ECHO                                                     'hello+world%21'
          1      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F9vRuH%3A7%240

Function %00%7Bclosure%7D%2Fin%2F9vRuH%3A20%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9vRuH
function name:  {closure}
number of ops:  4
compiled vars:  !0 = $id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
          1        CONCAT                                           ~1      'Hello+', !0
          2        ECHO                                                     ~1
          3      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F9vRuH%3A20%241

Class Foo:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9vRuH
function name:  __construct
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F9vRuH%3A7%240'
          1        ASSIGN_OBJ                                               'callable'
          2        OP_DATA                                                  ~1
    8     3      > RETURN                                                   null

End of function __construct

Function yesitdoes:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9vRuH
function name:  yesItDoes
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   FETCH_OBJ_R                                      ~0      'callable'
          1        INIT_DYNAMIC_CALL                                        ~0
          2        DO_FCALL                                      0          
   13     3      > RETURN                                                   null

End of function yesitdoes

End of class Foo.

Class Bar:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9vRuH
function name:  __construct
number of ops:  5
compiled vars:  !0 = $id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
   20     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F9vRuH%3A20%241'
          2        ASSIGN_OBJ                                               'name'
          3        OP_DATA                                                  ~2
   21     4      > RETURN                                                   null

End of function __construct

Function getname:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9vRuH
function name:  getName
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   FETCH_OBJ_R                                      ~0      'name'
          1        INIT_DYNAMIC_CALL                                        ~0
          2        DO_FCALL                                      0          
   26     3      > RETURN                                                   null

End of function getname

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
207.22 ms | 1399 KiB | 13 Q