3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class Subject { private function __construct() {} public static function getFactory() { return new Factory(function() { new Subject(); }); } } final class Factory { private $callback; public function __construct(callable $callback) { $this->callback = $callback; } public function getProduct() { return call_user_func($callback); } } $factory = Subject::getFactory(); $subject = $factory->getProduct();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9qQlD
function name:  (null)
number of ops:  7
compiled vars:  !0 = $factory, !1 = $subject
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   INIT_STATIC_METHOD_CALL                                  'Subject', 'getFactory'
          1        DO_FCALL                                      0  $2      
          2        ASSIGN                                                   !0, $2
   31     3        INIT_METHOD_CALL                                         !0, 'getProduct'
          4        DO_FCALL                                      0  $4      
          5        ASSIGN                                                   !1, $4
          6      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F9qQlD%3A9%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9qQlD
function name:  {closure}
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   NEW                                              $0      'Subject'
          1        DO_FCALL                                      0          
          2        FREE                                                     $0
   11     3      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F9qQlD%3A9%240

Class Subject:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9qQlD
function name:  __construct
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E > > RETURN                                                   null

End of function __construct

Function getfactory:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9qQlD
function name:  getFactory
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   NEW                                              $0      'Factory'
          1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F9qQlD%3A9%240'
   11     2        SEND_VAL_EX                                              ~1
          3        DO_FCALL                                      0          
          4      > RETURN                                                   $0
   12     5*     > RETURN                                                   null

End of function getfactory

End of class Subject.

Class Factory:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9qQlD
function name:  __construct
number of ops:  4
compiled vars:  !0 = $callback
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
   21     1        ASSIGN_OBJ                                               'callback'
          2        OP_DATA                                                  !0
   22     3      > RETURN                                                   null

End of function __construct

Function getproduct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9qQlD
function name:  getProduct
number of ops:  4
compiled vars:  !0 = $callback
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   INIT_USER_CALL                                0          'call_user_func', !0
          1        DO_FCALL                                      0  $1      
          2      > RETURN                                                   $1
   27     3*     > RETURN                                                   null

End of function getproduct

End of class Factory.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.36 ms | 1399 KiB | 13 Q