3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface Element { /** * Constructor function. Must pass existing config, or leave as * is for new element, where the default will be used instead. * * @param array $config Element configuration. */ public function __construct( $config = [] ); /** * Get the definition of the Element. * * @return array An array with 'title', 'description' and 'type' */ public static function get_definition(); /** * Get Element config variable. * * @return array Associative array of Element Config. */ public function get_config(); /** * Set Element config variable. * * @param array $config New configuration variable. * * @return void */ public function set_config( $config ); } abstract class Base implements Element { /** * Element configuration variable * * @var array */ protected $config = []; /** * Get Element config variable. * * @return array Associative array of Element Config. */ public function get_config() { return $this->config; } /** * Create an eForm Element instance * * @param array $config Element config. */ public function __construct( $config = [] ) { $this->set_config( $config ); } } class MyElement extends Base { public static function get_definition() { return [ 'type' => 'MyElement', ]; } public function set_config( $config ) { // Do something here $this->config = $config; } } $element = new MyElement( [ 'foo' => 'bar', ] ); print_r( $element->get_config() );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8NqqW
function name:  (null)
number of ops:  12
compiled vars:  !0 = $element
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   DECLARE_CLASS                                            'base'
   63     1        DECLARE_CLASS                                            'myelement', 'base'
   77     2        NEW                                              $1      'MyElement'
   78     3        SEND_VAL_EX                                              <array>
          4        DO_FCALL                                      0          
   77     5        ASSIGN                                                   !0, $1
   81     6        INIT_FCALL                                               'print_r'
          7        INIT_METHOD_CALL                                         !0, 'get_config'
          8        DO_FCALL                                      0  $4      
          9        SEND_VAR                                                 $4
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

Class Element:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8NqqW
function name:  __construct
number of ops:  2
compiled vars:  !0 = $config
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV_INIT                                        !0      <array>
          1      > RETURN                                                   null

End of function __construct

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

End of function get_definition

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

End of function get_config

Function set_config:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8NqqW
function name:  set_config
number of ops:  2
compiled vars:  !0 = $config
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   RECV                                             !0      
          1      > RETURN                                                   null

End of function set_config

End of class Element.

Class Base:
Function get_config:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8NqqW
function name:  get_config
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   50     0  E >   FETCH_OBJ_R                                      ~0      'config'
          1      > RETURN                                                   ~0
   51     2*     > RETURN                                                   null

End of function get_config

Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8NqqW
function name:  __construct
number of ops:  5
compiled vars:  !0 = $config
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   58     0  E >   RECV_INIT                                        !0      <array>
   59     1        INIT_METHOD_CALL                                         'set_config'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
   60     4      > RETURN                                                   null

End of function __construct

End of class Base.

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

End of function get_definition

Function set_config:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8NqqW
function name:  set_config
number of ops:  4
compiled vars:  !0 = $config
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   71     0  E >   RECV                                             !0      
   73     1        ASSIGN_OBJ                                               'config'
          2        OP_DATA                                                  !0
   74     3      > RETURN                                                   null

End of function set_config

End of class MyElement.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.46 ms | 1400 KiB | 15 Q