3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class CanNotSetProperties extends BadMethodCallException { public function __construct($message) { parent::__construct($message); } public function exception($message) { return new static($message); } } final class ConstructorIsVisible extends BadMethodCallException { public function __construct($message) { parent::__construct($message); } public function exception($message) { return new static($message); } } trait Immutable { public function __set($property, $value) { throw CanNotSetProperties::exception(); } protected function __construct() { throw ConstructorIsVisible::exception(); } } final class Test { use Immutable; public function __construct() { echo 'hello'; } } $test = new Test; $test->__construct();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CEqLT
function name:  (null)
number of ops:  7
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   42     0  E >   DECLARE_CLASS                                            'test'
   51     1        NEW                                              $1      'Test'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   52     4        INIT_METHOD_CALL                                         !0, '__construct'
          5        DO_FCALL                                      0          
          6      > RETURN                                                   1

Class CanNotSetProperties:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CEqLT
function name:  __construct
number of ops:  5
compiled vars:  !0 = $message
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    7     1        INIT_STATIC_METHOD_CALL                                  
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
    8     4      > RETURN                                                   null

End of function __construct

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

End of function exception

End of class CanNotSetProperties.

Class ConstructorIsVisible:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CEqLT
function name:  __construct
number of ops:  5
compiled vars:  !0 = $message
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
   20     1        INIT_STATIC_METHOD_CALL                                  
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
   21     4      > RETURN                                                   null

End of function __construct

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

End of function exception

End of class ConstructorIsVisible.

Class Immutable:
Function __set:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/CEqLT
function name:  __set
number of ops:  6
compiled vars:  !0 = $property, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   33     2        INIT_STATIC_METHOD_CALL                                  'CanNotSetProperties', 'exception'
          3        DO_FCALL                                      0  $2      
          4      > THROW                                         0          $2
   34     5*     > RETURN                                                   null

End of function __set

Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/CEqLT
function name:  __construct
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   38     0  E >   INIT_STATIC_METHOD_CALL                                  'ConstructorIsVisible', 'exception'
          1        DO_FCALL                                      0  $0      
          2      > THROW                                         0          $0
   39     3*     > RETURN                                                   null

End of function __construct

End of class Immutable.

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

End of function __construct

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.59 ms | 1390 KiB | 13 Q