3v4l.org

run code in 300+ PHP versions simultaneously
<?php class myModel { public static function all() { return 1; } } class myClass { public $models; public $results; public function __construct() { $this->models = new StdClass; $this->models->myModel = new myModel; $this->results = $this->models->myModel::all(); } } $result = (new myClass)->results; echo $result;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1Ajjc
function name:  (null)
number of ops:  6
compiled vars:  !0 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   NEW                                              $1      'myClass'
          1        DO_FCALL                                      0          
          2        FETCH_OBJ_R                                      ~3      $1, 'results'
          3        ASSIGN                                                   !0, ~3
   24     4        ECHO                                                     !0
          5      > RETURN                                                   1

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

End of function all

End of class myModel.

Class myClass:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1Ajjc
function name:  __construct
number of ops:  17
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   NEW                                              $1      'StdClass'
          1        DO_FCALL                                      0          
          2        ASSIGN_OBJ                                               'models'
          3        OP_DATA                                                  $1
   18     4        NEW                                              $5      'myModel'
          5        DO_FCALL                                      0          
          6        FETCH_OBJ_W                                      $3      'models'
          7        ASSIGN_OBJ                                               $3, 'myModel'
          8        OP_DATA                                                  $5
   19     9        FETCH_OBJ_R                                      ~8      'models'
         10        FETCH_OBJ_R                                      ~9      ~8, 'myModel'
         11        FETCH_CLASS                                   0  $10     ~9
         12        INIT_STATIC_METHOD_CALL                                  $10, 'all'
         13        DO_FCALL                                      0  $11     
         14        ASSIGN_OBJ                                               'results'
         15        OP_DATA                                                  $11
   20    16      > RETURN                                                   null

End of function __construct

End of class myClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
179.63 ms | 1395 KiB | 13 Q