3v4l.org

run code in 500+ PHP versions simultaneously
<?php function createTestClass() { $test = new class() { static public $initialised = false; static public function __init() { if (self::$initialised) { throw new Exception("Already initialised."); } self::$initialised = true; } }; $test::__init(); } createTestClass(); createTestClass();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oct85
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   19     0  E >   INIT_FCALL                                                   'createtestclass'
          1        DO_FCALL                                          0          
   20     2        INIT_FCALL                                                   'createtestclass'
          3        DO_FCALL                                          0          
          4      > RETURN                                                       1

Function createtestclass:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oct85
function name:  createTestClass
number of ops:  8
compiled vars:  !0 = $test
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   DECLARE_ANON_CLASS                                   <unknown> 
          1        NEW                                                  $2      $1
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !0, $2
   16     4        FETCH_CLASS                                       0  $5      !0
          5        INIT_STATIC_METHOD_CALL                                      $5, '__init'
          6        DO_FCALL                                          0          
   17     7      > RETURN                                                       null

End of function createtestclass

Class class@anonymous:
Function __init:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 2, Position 2 = 6
Branch analysis from position: 2
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oct85
function name:  __init
number of ops:  9
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    8     0  E >   FETCH_STATIC_PROP_R              unknown             ~0      'initialised'
          1      > JMPZ                                                         ~0, ->6
    9     2    >   NEW                                                  $1      'Exception'
          3        SEND_VAL_EX                                                  'Already+initialised.'
          4        DO_FCALL                                          0          
          5      > THROW                                             0          $1
   12     6    >   ASSIGN_STATIC_PROP                                           'initialised'
          7        OP_DATA                                                      <true>
   13     8      > RETURN                                                       null

End of function __init

End of class class@anonymous.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
158.44 ms | 2807 KiB | 10 Q