3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Aparent { protected $is_something; public function __construct() { $this->is_something = FALSE; $this->thing(); } public function thing() { if ($this->is_something) { print "Aparent.thing() reports is_something as TRUE\n"; } else { print "Aparent.thing() reports is_something as FALSE\n"; } } } class Achild extends Aparent { public function thing() { print "Achild before changing is_something\n"; if ($this->is_something) { print "Achild.thing() reports is_something as TRUE\n"; } else { print "Achild.thing() reports is_something as FALSE\n"; } $this->is_something = TRUE; print "Achild after changing is_something\n"; if ($this->is_something) { print "Achild.thing() reports is_something as TRUE\n"; } else { print "Achild.thing() reports is_something as FALSE\n"; } print "Achild calling parent::thing()\n"; parent::thing(); } } $o = new Achild();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/csJTn
function name:  (null)
number of ops:  4
compiled vars:  !0 = $o
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   47     0  E >   NEW                                              $1      'Achild'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
          3      > RETURN                                                   1

Class Aparent:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/csJTn
function name:  __construct
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   ASSIGN_OBJ                                               'is_something'
          1        OP_DATA                                                  <false>
    7     2        INIT_METHOD_CALL                                         'thing'
          3        DO_FCALL                                      0          
    8     4      > RETURN                                                   null

End of function __construct

Function thing:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 2, Position 2 = 4
Branch analysis from position: 2
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/csJTn
function name:  thing
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   FETCH_OBJ_R                                      ~0      'is_something'
          1      > JMPZ                                                     ~0, ->4
   12     2    >   ECHO                                                     'Aparent.thing%28%29+reports+is_something+as+TRUE%0A'
          3      > JMP                                                      ->5
   15     4    >   ECHO                                                     'Aparent.thing%28%29+reports+is_something+as+FALSE%0A'
   17     5    > > RETURN                                                   null

End of function thing

End of class Aparent.

Class Achild:
Function thing:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 13
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 13
Branch analysis from position: 11
Branch analysis from position: 13
filename:       /in/csJTn
function name:  thing
number of ops:  18
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   ECHO                                                     'Achild+before+changing+is_something%0A'
   24     1        FETCH_OBJ_R                                      ~0      'is_something'
          2      > JMPZ                                                     ~0, ->5
   25     3    >   ECHO                                                     'Achild.thing%28%29+reports+is_something+as+TRUE%0A'
          4      > JMP                                                      ->6
   28     5    >   ECHO                                                     'Achild.thing%28%29+reports+is_something+as+FALSE%0A'
   31     6    >   ASSIGN_OBJ                                               'is_something'
          7        OP_DATA                                                  <true>
   33     8        ECHO                                                     'Achild+after+changing+is_something%0A'
   34     9        FETCH_OBJ_R                                      ~2      'is_something'
         10      > JMPZ                                                     ~2, ->13
   35    11    >   ECHO                                                     'Achild.thing%28%29+reports+is_something+as+TRUE%0A'
         12      > JMP                                                      ->14
   38    13    >   ECHO                                                     'Achild.thing%28%29+reports+is_something+as+FALSE%0A'
   41    14    >   ECHO                                                     'Achild+calling+parent%3A%3Athing%28%29%0A'
   42    15        INIT_STATIC_METHOD_CALL                                  'thing'
         16        DO_FCALL                                      0          
   43    17      > RETURN                                                   null

End of function thing

Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/csJTn
function name:  __construct
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   ASSIGN_OBJ                                               'is_something'
          1        OP_DATA                                                  <false>
    7     2        INIT_METHOD_CALL                                         'thing'
          3        DO_FCALL                                      0          
    8     4      > RETURN                                                   null

End of function __construct

End of class Achild.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.5 ms | 1399 KiB | 13 Q