3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Token { protected $name; protected $closure; public function __construct($name, \Closure $closure) { $this->name = $name; $this->closure = $closure; } public function execute() { return call_user_func_array($this->closure, func_get_args()); } } $token = new Token('test', function($test) { return "123".$test; }); echo $token->execute();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6rtj8
function name:  (null)
number of ops:  10
compiled vars:  !0 = $token
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   NEW                                              $1      'Token'
          1        SEND_VAL_EX                                              'test'
          2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F6rtj8%3A18%240'
          3        SEND_VAL_EX                                              ~2
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $1
   19     6        INIT_METHOD_CALL                                         !0, 'execute'
          7        DO_FCALL                                      0  $5      
          8        ECHO                                                     $5
          9      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F6rtj8%3A18%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6rtj8
function name:  {closure}
number of ops:  4
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
          1        CONCAT                                           ~1      '123', !0
          2      > RETURN                                                   ~1
          3*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F6rtj8%3A18%240

Class Token:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6rtj8
function name:  __construct
number of ops:  7
compiled vars:  !0 = $name, !1 = $closure
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    8     2        ASSIGN_OBJ                                               'name'
          3        OP_DATA                                                  !0
    9     4        ASSIGN_OBJ                                               'closure'
          5        OP_DATA                                                  !1
   10     6      > RETURN                                                   null

End of function __construct

Function execute:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6rtj8
function name:  execute
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   FETCH_OBJ_R                                      ~0      'closure'
          1        INIT_USER_CALL                                0          'call_user_func_array', ~0
          2        FUNC_GET_ARGS                                    ~1      
          3        SEND_ARRAY                                               ~1
          4        CHECK_UNDEF_ARGS                                         
          5        DO_FCALL                                      0  $2      
          6      > RETURN                                                   $2
   15     7*     > RETURN                                                   null

End of function execute

End of class Token.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.99 ms | 1399 KiB | 13 Q