3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class parentTest{ protected $innerVar = ''; public function __construct() { if(empty($this->innerVar)){ echo 'too soon'; throw(new Exception('too soon')); } }}abstract class childTest extends parentTest{ protected $outerVar = ''; public function __construct() { if(empty($this->innerVar) || empty($this->outerVar)){ echo 'too soon'; throw(new Exception('too soon')); } }}class implTest extends parentTest{ protected $innerVar = 'hi';}class implChildTest extends childTest{ protected $innerVar = 'hi'; protected $outerVar = 'hello there';}new implTest();new implChildTest();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4i4Ch
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    1     0  E >   NEW                                              $0      'implTest'
          1        DO_FCALL                                      0          
          2        FREE                                                     $0
          3        NEW                                              $2      'implChildTest'
          4        DO_FCALL                                      0          
          5        FREE                                                     $2
          6      > RETURN                                                   1

Class parentTest:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 2, Position 2 = 7
Branch analysis from position: 2
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4i4Ch
function name:  __construct
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
          0  E >   ISSET_ISEMPTY_PROP_OBJ                                   'innerVar'
          1      > JMPZ                                                     ~0, ->7
          2    >   ECHO                                                     'too+soon'
          3        NEW                                              $1      'Exception'
          4        SEND_VAL_EX                                              'too+soon'
          5        DO_FCALL                                      0          
          6      > THROW                                         0          $1
          7    > > RETURN                                                   null

End of function __construct

End of class parentTest.

Class childTest:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 2, Position 2 = 4
Branch analysis from position: 2
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 10
Branch analysis from position: 5
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
filename:       /in/4i4Ch
function name:  __construct
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
          0  E >   ISSET_ISEMPTY_PROP_OBJ                           ~0      'innerVar'
          1      > JMPNZ_EX                                         ~0      ~0, ->4
          2    >   ISSET_ISEMPTY_PROP_OBJ                           ~1      'outerVar'
          3        BOOL                                             ~0      ~1
          4    > > JMPZ                                                     ~0, ->10
          5    >   ECHO                                                     'too+soon'
          6        NEW                                              $2      'Exception'
          7        SEND_VAL_EX                                              'too+soon'
          8        DO_FCALL                                      0          
          9      > THROW                                         0          $2
         10    > > RETURN                                                   null

End of function __construct

End of class childTest.

Class implTest:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 2, Position 2 = 7
Branch analysis from position: 2
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4i4Ch
function name:  __construct
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
          0  E >   ISSET_ISEMPTY_PROP_OBJ                                   'innerVar'
          1      > JMPZ                                                     ~0, ->7
          2    >   ECHO                                                     'too+soon'
          3        NEW                                              $1      'Exception'
          4        SEND_VAL_EX                                              'too+soon'
          5        DO_FCALL                                      0          
          6      > THROW                                         0          $1
          7    > > RETURN                                                   null

End of function __construct

End of class implTest.

Class implChildTest:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 2, Position 2 = 4
Branch analysis from position: 2
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 10
Branch analysis from position: 5
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
filename:       /in/4i4Ch
function name:  __construct
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
          0  E >   ISSET_ISEMPTY_PROP_OBJ                           ~0      'innerVar'
          1      > JMPNZ_EX                                         ~0      ~0, ->4
          2    >   ISSET_ISEMPTY_PROP_OBJ                           ~1      'outerVar'
          3        BOOL                                             ~0      ~1
          4    > > JMPZ                                                     ~0, ->10
          5    >   ECHO                                                     'too+soon'
          6        NEW                                              $2      'Exception'
          7        SEND_VAL_EX                                              'too+soon'
          8        DO_FCALL                                      0          
          9      > THROW                                         0          $2
         10    > > RETURN                                                   null

End of function __construct

End of class implChildTest.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.26 ms | 1399 KiB | 13 Q