3v4l.org

run code in 500+ PHP versions simultaneously
<?php class X { static public $p = 1; static function foo() {} function __toString() : string { return 'foo'; } } $name = []; // try with different type : bool, int, float, object.. try { echo X::$name; } catch (Error $e) { print $e->getMessage(); } $name = []; try { echo X::${$name}(); } catch (Error $e) { print $e->getMessage(); } ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 5
Branch analysis from position: 5
2 jumps found. (Code = 107) Position 1 = 6, Position 2 = -2
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
Found catch point at position: 15
Branch analysis from position: 15
2 jumps found. (Code = 107) Position 1 = 16, Position 2 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aKlmO
function name:  (null)
number of ops:  20
compiled vars:  !0 = $name, !1 = $e
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                                'x'
   13     1        ASSIGN                                                       !0, <array>
   15     2        FETCH_STATIC_PROP_R              unknown             ~3      'name'
          3        ECHO                                                         ~3
          4      > JMP                                                          ->9
   16     5  E > > CATCH                                           last         'Error'
   17     6    >   INIT_METHOD_CALL                                             !1, 'getMessage'
          7        DO_FCALL                                          0  $4      
          8        ECHO                                                         $4
   20     9    >   ASSIGN                                                       !0, <array>
   22    10        FETCH_R                          local               ~6      !0
         11        INIT_STATIC_METHOD_CALL                                      'X', ~6
         12        DO_FCALL                                          0  $7      
         13        ECHO                                                         $7
         14      > JMP                                                          ->19
   23    15  E > > CATCH                                           last         'Error'
   24    16    >   INIT_METHOD_CALL                                             !1, 'getMessage'
         17        DO_FCALL                                          0  $8      
         18        ECHO                                                         $8
   27    19    > > RETURN                                                       1

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

End of function foo

Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aKlmO
function name:  __toString
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E > > RETURN                                                       'foo'
   10     1*       VERIFY_RETURN_TYPE                                           
          2*     > RETURN                                                       null

End of function __tostring

End of class X.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
152.4 ms | 1485 KiB | 13 Q