3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Bar { // protected $compat_fields = array(); public function __construct() { } } class Foo extends Bar { public function __construct() { parent::__construct(); if ( $this->compat_fields && is_array( $this->compat_fields ) ) { array_push( $this->compat_fields, 'all_items' ); } $this->all_items = array(); } } $foo = new Foo(); var_dump( $foo->all_items );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8djK8
function name:  (null)
number of ops:  8
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   NEW                                              $1      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   24     3        INIT_FCALL                                               'var_dump'
          4        FETCH_OBJ_R                                      ~4      !0, 'all_items'
          5        SEND_VAL                                                 ~4
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

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

End of function __construct

End of class Bar.

Class Foo:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 13
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
Branch analysis from position: 7
filename:       /in/8djK8
function name:  __construct
number of ops:  16
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_STATIC_METHOD_CALL                                  
          1        DO_FCALL                                      0          
   15     2        FETCH_OBJ_R                                      ~1      'compat_fields'
          3      > JMPZ_EX                                          ~1      ~1, ->7
          4    >   FETCH_OBJ_R                                      ~2      'compat_fields'
          5        TYPE_CHECK                                  128  ~3      ~2
          6        BOOL                                             ~1      ~3
          7    > > JMPZ                                                     ~1, ->13
   16     8    >   INIT_FCALL                                               'array_push'
          9        FETCH_OBJ_W                                      $4      'compat_fields'
         10        SEND_REF                                                 $4
         11        SEND_VAL                                                 'all_items'
         12        DO_ICALL                                                 
   19    13    >   ASSIGN_OBJ                                               'all_items'
         14        OP_DATA                                                  <array>
   20    15      > RETURN                                                   null

End of function __construct

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.9 ms | 1461 KiB | 15 Q