3v4l.org

run code in 300+ PHP versions simultaneously
<?php // https://github.com/bcit-ci/CodeIgniter/blob/635256265a38e655c00f4415d5f09700f28c5805/system/core/Common.php#L140 function load_class($class) { return (new $class()); } // https://github.com/bcit-ci/CodeIgniter/blob/b862664f2ce2d20382b9af5bfa4dd036f5755409/system/core/CodeIgniter.php#L316 function &get_instance() { return CI_Controller::get_instance(); } // https://github.com/bcit-ci/CodeIgniter/blob/b862664f2ce2d20382b9af5bfa4dd036f5755409/system/core/Loader.php#L51 class CI_Loader { public function model($model, $name = '', $db_conn = FALSE) { $class = $model.'Model'; $CI =& get_instance(); $CI->{$model} = new $class; } } // https://github.com/bcit-ci/CodeIgniter/blob/b862664f2ce2d20382b9af5bfa4dd036f5755409/system/core/Controller.php#L52 class CI_Controller { private static $instance; /** * Class constructor * * @return void */ public function __construct() { self::$instance =& $this; $this->load =& load_class('CI_Loader'); } /** * Get the CI singleton * * @static * @return object */ public static function &get_instance() { return self::$instance; } } // your models class fooModel { public $foo; } class barModel { public $bar; } // your controller class Controller extends CI_Controller { public function indexAction() { $this->load->model('foo'); $this->load->model('bar'); } } // instance container $app = (new class{}); $app->controller = new Controller(); // loaded by router $app->controller->indexAction(); print_r($app);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fPCK3
function name:  (null)
number of ops:  15
compiled vars:  !0 = $app
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   73     0  E >   DECLARE_ANON_CLASS                               <unknown> 
          1        NEW                                              $2      $1
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   74     4        NEW                                              $6      'Controller'
          5        DO_FCALL                                      0          
          6        ASSIGN_OBJ                                               !0, 'controller'
          7        OP_DATA                                                  $6
   77     8        FETCH_OBJ_R                                      ~8      !0, 'controller'
          9        INIT_METHOD_CALL                                         ~8, 'indexAction'
         10        DO_FCALL                                      0          
   79    11        INIT_FCALL                                               'print_r'
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                                 
         14      > RETURN                                                   1

Function load_class:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fPCK3
function name:  load_class
number of ops:  6
compiled vars:  !0 = $class
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        FETCH_CLASS                                   0  $1      !0
          2        NEW                                              $2      $1
          3        DO_FCALL                                      0          
          4      > RETURN                                                   $2
    5     5*     > RETURN                                                   null

End of function load_class

Function get_instance:
Finding entry points
Branch analysis from position: 0
Return found
filename:       /in/fPCK3
function name:  get_instance
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_STATIC_METHOD_CALL                                  'CI_Controller', 'get_instance'
          1        DO_FCALL                                      0  $0      
          2      > RETURN_BY_REF                                            $0
   10     3*     > RETURN_BY_REF                                            null

End of function get_instance

Class CI_Loader:
Function model:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fPCK3
function name:  model
number of ops:  14
compiled vars:  !0 = $model, !1 = $name, !2 = $db_conn, !3 = $class, !4 = $CI
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      ''
          2        RECV_INIT                                        !2      <false>
   17     3        CONCAT                                           ~5      !0, 'Model'
          4        ASSIGN                                                   !3, ~5
   19     5        INIT_FCALL                                               'get_instance'
          6        DO_FCALL                                      0  $7      
          7        ASSIGN_REF                                               !4, $7
   21     8        FETCH_CLASS                                   0  $10     !3
          9        NEW                                              $11     $10
         10        DO_FCALL                                      0          
         11        ASSIGN_OBJ                                               !4, !0
         12        OP_DATA                                                  $11
   22    13      > RETURN                                                   null

End of function model

End of class CI_Loader.

Class CI_Controller:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fPCK3
function name:  __construct
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   36     0  E >   FETCH_THIS                                       $1      
          1        MAKE_REF                                         $2      $1
          2        ASSIGN_STATIC_PROP_REF                                   'instance'
          3        OP_DATA                                                  $2
   38     4        INIT_FCALL                                               'load_class'
          5        SEND_VAL                                                 'CI_Loader'
          6        DO_FCALL                                      0  $4      
          7        MAKE_REF                                         $5      $4
          8        ASSIGN_OBJ_REF                                           'load'
          9        OP_DATA                                                  $5
   39    10      > RETURN                                                   null

End of function __construct

Function get_instance:
Finding entry points
Branch analysis from position: 0
Return found
filename:       /in/fPCK3
function name:  get_instance
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   49     0  E >   FETCH_STATIC_PROP_W          unknown             $0      'instance'
          1      > RETURN_BY_REF                                            $0
   50     2*     > RETURN_BY_REF                                            null

End of function get_instance

End of class CI_Controller.

Class fooModel: [no user functions]
Class barModel: [no user functions]
Class Controller:
Function indexaction:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fPCK3
function name:  indexAction
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   67     0  E >   FETCH_OBJ_R                                      ~0      'load'
          1        INIT_METHOD_CALL                                         ~0, 'model'
          2        SEND_VAL_EX                                              'foo'
          3        DO_FCALL                                      0          
   68     4        FETCH_OBJ_R                                      ~2      'load'
          5        INIT_METHOD_CALL                                         ~2, 'model'
          6        SEND_VAL_EX                                              'bar'
          7        DO_FCALL                                      0          
   69     8      > RETURN                                                   null

End of function indexaction

Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fPCK3
function name:  __construct
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   36     0  E >   FETCH_THIS                                       $1      
          1        MAKE_REF                                         $2      $1
          2        ASSIGN_STATIC_PROP_REF                                   'instance'
          3        OP_DATA                                                  $2
   38     4        INIT_FCALL                                               'load_class'
          5        SEND_VAL                                                 'CI_Loader'
          6        DO_FCALL                                      0  $4      
          7        MAKE_REF                                         $5      $4
          8        ASSIGN_OBJ_REF                                           'load'
          9        OP_DATA                                                  $5
   39    10      > RETURN                                                   null

End of function __construct

Function get_instance:
Finding entry points
Branch analysis from position: 0
Return found
filename:       /in/fPCK3
function name:  get_instance
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   49     0  E >   FETCH_STATIC_PROP_W          unknown             $0      'instance'
          1      > RETURN_BY_REF                                            $0
   50     2*     > RETURN_BY_REF                                            null

End of function get_instance

End of class Controller.

Class class@anonymous: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.72 ms | 1448 KiB | 17 Q