3v4l.org

run code in 300+ PHP versions simultaneously
<?php class PhpNw15Conference { public function listSpeakers() { return array('James Mallison', 'Some universally hated Ruby developer'); }} /** * Class Controller */ class Controller extends BaseController { /** * @return array */ public function __construct(PhpNw15Conference $conference) { $this->conference = $conference; } public function speakersAction() { $speakers = $this->conference->listSpeakers(); /** Pass to template or CLI runner **/ return $speakers; } } /** Controller Resolver **/ $controller = 'Controller'; // Retrieved from URL + YAML config $action = 'speakersAction'; // Retrieved from URL + Yaml config $params = array(); // Retrieved from GET / POST parameters $reflector = new \ReflectionClass('Controller'); foreach ($reflector->getConstructor()->getParameters() as $parameter) { $className = $parameter->getClass()->getName(); $parameter = new $className; } var_dump((new $controller($parameter))->$action($params));
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 24
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 24
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/nmGfq
function name:  (null)
number of ops:  36
compiled vars:  !0 = $controller, !1 = $action, !2 = $params, !3 = $reflector, !4 = $parameter, !5 = $className
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   DECLARE_CLASS                                            'controller', 'basecontroller'
   28     1        ASSIGN                                                   !0, 'Controller'
   29     2        ASSIGN                                                   !1, 'speakersAction'
   30     3        ASSIGN                                                   !2, <array>
   32     4        NEW                                              $9      'ReflectionClass'
          5        SEND_VAL_EX                                              'Controller'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !3, $9
   34     8        INIT_METHOD_CALL                                         !3, 'getConstructor'
          9        DO_FCALL                                      0  $12     
         10        INIT_METHOD_CALL                                         $12, 'getParameters'
         11        DO_FCALL                                      0  $13     
         12      > FE_RESET_R                                       $14     $13, ->24
         13    > > FE_FETCH_R                                               $14, !4, ->24
   36    14    >   INIT_METHOD_CALL                                         !4, 'getClass'
         15        DO_FCALL                                      0  $15     
         16        INIT_METHOD_CALL                                         $15, 'getName'
         17        DO_FCALL                                      0  $16     
         18        ASSIGN                                                   !5, $16
   37    19        FETCH_CLASS                                   0  $18     !5
         20        NEW                                              $19     $18
         21        DO_FCALL                                      0          
         22        ASSIGN                                                   !4, $19
   34    23      > JMP                                                      ->13
         24    >   FE_FREE                                                  $14
   40    25        INIT_FCALL                                               'var_dump'
         26        FETCH_CLASS                                   0  $22     !0
         27        NEW                                              $23     $22
         28        SEND_VAR_EX                                              !4
         29        DO_FCALL                                      0          
         30        INIT_METHOD_CALL                                         $23, !1
         31        SEND_VAR_EX                                              !2
         32        DO_FCALL                                      0  $25     
         33        SEND_VAR                                                 $25
         34        DO_ICALL                                                 
         35      > RETURN                                                   1

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

End of function listspeakers

End of class PhpNw15Conference.

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

End of function __construct

Function speakersaction:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nmGfq
function name:  speakersAction
number of ops:  6
compiled vars:  !0 = $speakers
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   FETCH_OBJ_R                                      ~1      'conference'
          1        INIT_METHOD_CALL                                         ~1, 'listSpeakers'
          2        DO_FCALL                                      0  $2      
          3        ASSIGN                                                   !0, $2
   23     4      > RETURN                                                   !0
   24     5*     > RETURN                                                   null

End of function speakersaction

End of class Controller.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.34 ms | 1400 KiB | 15 Q