3v4l.org

run code in 300+ 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 = 4, Position 2 = 7
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 16
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ucrGP
function name:  (null)
number of ops:  20
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'class_exists'
          1        SEND_VAL                                                 'A'
          2        DO_ICALL                                         $0      
          3      > JMPZ                                                     $0, ->7
    4     4    >   ECHO                                                     '1+A+exists%2C+early+returning.%0A'
    5     5      > RETURN                                                   null
    3     6*       JMP                                                      ->8
    7     7    >   ECHO                                                     '1+A+does+not+exist%2C+continuing.%0A'
   10     8        ECHO                                                     '1+Continuing+evaluation%E2%80%A6%0A'
   15     9        INIT_FCALL                                               'class_exists'
         10        SEND_VAL                                                 'A'
         11        DO_ICALL                                         $1      
         12      > JMPZ                                                     $1, ->16
   16    13    >   ECHO                                                     '2+A+exists%2C+early+returning.%0A'
   17    14      > RETURN                                                   null
   15    15*       JMP                                                      ->17
   19    16    >   ECHO                                                     '2+A+does+not+exist%2C+continuing.%0A'
   22    17        ECHO                                                     '2+Continuing+evaluation%E2%80%A6%0A'
   25    18        DECLARE_CLASS                                            'a'
   27    19      > 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.0.0


preferences:
124.67 ms | 1010 KiB | 14 Q