3v4l.org

run code in 500+ PHP versions simultaneously
<?php if (class_exists('A')) { echo "1 A exists, early returning.\n"; return; } else { echo "1 A does not exist, continuing.\n"; } echo "1 Continuing evaluation…\n"; class A {} function f() {} if (class_exists('A')) { echo "2 A exists, early returning.\n"; return; } else { echo "2 A does not exist, continuing.\n"; } echo "2 Continuing evaluation…\n"; // Apparently this is fine even though we're defining the same class? class A {} // Uncomment this and it's an error: // function f() {}
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 2, Position 2 = 5
Branch analysis from position: 2
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 12
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ucrGP
function name:  (null)
number of ops:  16
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   FRAMELESS_ICALL_1                class_exists        ~0      'A'
          1      > JMPZ                                                         ~0, ->5
    4     2    >   ECHO                                                         '1+A+exists%2C+early+returning.%0A'
    5     3      > RETURN                                                       null
    3     4*       JMP                                                          ->6
    7     5    >   ECHO                                                         '1+A+does+not+exist%2C+continuing.%0A'
   10     6        ECHO                                                         '1+Continuing+evaluation%E2%80%A6%0A'
   15     7        FRAMELESS_ICALL_1                class_exists        ~1      'A'
          8      > JMPZ                                                         ~1, ->12
   16     9    >   ECHO                                                         '2+A+exists%2C+early+returning.%0A'
   17    10      > RETURN                                                       null
   15    11*       JMP                                                          ->13
   19    12    >   ECHO                                                         '2+A+does+not+exist%2C+continuing.%0A'
   22    13        ECHO                                                         '2+Continuing+evaluation%E2%80%A6%0A'
   25    14        DECLARE_CLASS                                                'a'
   27    15      > RETURN                                                       1

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

End of function f

Class A: [no user functions]
Class A: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
211.43 ms | 3348 KiB | 13 Q