3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { private $var; public function __construct($param = null) { if($param !== null) { $this->var = $param; } } public function getVar() { if($this->var === null) { throw new Exception('Var not set. You sir, fucked up!'); } return $this->var; } } $test = new Test('Hello World'); echo $test->getVar();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ni2TV
function name:  (null)
number of ops:  8
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   NEW                                              $1      'Test'
          1        SEND_VAL_EX                                              'Hello+World'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   20     4        INIT_METHOD_CALL                                         !0, 'getVar'
          5        DO_FCALL                                      0  $4      
          6        ECHO                                                     $4
          7      > RETURN                                                   1

Class Test:
Function __construct:
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 = 62) Position 1 = -2
Branch analysis from position: 5
filename:       /in/Ni2TV
function name:  __construct
number of ops:  6
compiled vars:  !0 = $param
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV_INIT                                        !0      null
    6     1        TYPE_CHECK                                  1020          !0
          2      > JMPZ                                                     ~1, ->5
    7     3    >   ASSIGN_OBJ                                               'var'
          4        OP_DATA                                                  !0
    9     5    > > RETURN                                                   null

End of function __construct

Function getvar:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ni2TV
function name:  getVar
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   FETCH_OBJ_R                                      ~0      'var'
          1        TYPE_CHECK                                    2          ~0
          2      > JMPZ                                                     ~1, ->7
   13     3    >   NEW                                              $2      'Exception'
          4        SEND_VAL_EX                                              'Var+not+set.+You+sir%2C+fucked+up%21'
          5        DO_FCALL                                      0          
          6      > THROW                                         0          $2
   15     7    >   FETCH_OBJ_R                                      ~4      'var'
          8      > RETURN                                                   ~4
   16     9*     > RETURN                                                   null

End of function getvar

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.27 ms | 1395 KiB | 13 Q