3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(E_ALL); echo 'Testing on PHP version ' . PHP_VERSION . PHP_EOL . PHP_EOL; #sleep(1); echo 'Checking if __DIR__ is defined...' . PHP_EOL; if (!defined('__DIR__')) { #sleep(2); echo 'Nope, defined() returned (bool)false.' . PHP_EOL; echo 'So, seems like the magic constant __DIR__ is not defined.' . PHP_EOL . PHP_EOL; #sleep(2); echo 'No prob. Executing define(\'__DIR__\', \'/foo/bar\')...' . PHP_EOL; define('__DIR__', '/foo/bar'); #sleep(1); echo 'Done, defined __DIR__ as "/foo/bar".' . PHP_EOL . PHP_EOL; #sleep(1); echo 'Double-checking __DIR__ is defined now...' . PHP_EOL; #sleep(2); if (!defined('__DIR__')) { echo 'WTF, defined(\'__DIR__\') again returned (bool)false?!' . PHP_EOL; } else{ echo 'Strike, this time defined(\'__DIR__\') returned (bool)true.' . PHP_EOL; echo 'So, seems like __DIR__ was successfully defined. :)' . PHP_EOL . PHP_EOL; } } else{ echo 'Yep, defined(\'__DIR__\') returned (bool)true.' . PHP_EOL; echo 'The magic constant __DIR__ seems to be defined.' . PHP_EOL . PHP_EOL; } #sleep(2); echo 'Finally, here is the result of var_dump(__DIR__):' . PHP_EOL; var_dump(__DIR__);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 25
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 22
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/95v4u
function name:  (null)
number of ops:  32
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'error_reporting'
          1        SEND_VAL                                                 32767
          2        DO_ICALL                                                 
    4     3        ECHO                                                     'Testing+on+PHP+version+8.0.0%0A%0A'
    7     4        ECHO                                                     'Checking+if+__DIR__+is+defined...%0A'
    8     5        DEFINED                                          ~1      '__DIR__'
          6        BOOL_NOT                                         ~2      ~1
          7      > JMPZ                                                     ~2, ->25
   11     8    >   ECHO                                                     'Nope%2C+defined%28%29+returned+%28bool%29false.%0A'
   12     9        ECHO                                                     'So%2C+seems+like+the+magic+constant+__DIR__+is+not+defined.%0A%0A'
   15    10        ECHO                                                     'No+prob.+Executing+define%28%27__DIR__%27%2C+%27%2Ffoo%2Fbar%27%29...%0A'
   16    11        INIT_FCALL                                               'define'
         12        SEND_VAL                                                 '__DIR__'
         13        SEND_VAL                                                 '%2Ffoo%2Fbar'
         14        DO_ICALL                                                 
   19    15        ECHO                                                     'Done%2C+defined+__DIR__+as+%22%2Ffoo%2Fbar%22.%0A%0A'
   22    16        ECHO                                                     'Double-checking+__DIR__+is+defined+now...%0A'
   25    17        DEFINED                                          ~4      '__DIR__'
         18        BOOL_NOT                                         ~5      ~4
         19      > JMPZ                                                     ~5, ->22
   26    20    >   ECHO                                                     'WTF%2C+defined%28%27__DIR__%27%29+again+returned+%28bool%29false%3F%21%0A'
         21      > JMP                                                      ->24
   28    22    >   ECHO                                                     'Strike%2C+this+time+defined%28%27__DIR__%27%29+returned+%28bool%29true.%0A'
   29    23        ECHO                                                     'So%2C+seems+like+__DIR__+was+successfully+defined.+%3A%29%0A%0A'
         24    > > JMP                                                      ->27
   32    25    >   ECHO                                                     'Yep%2C+defined%28%27__DIR__%27%29+returned+%28bool%29true.%0A'
   33    26        ECHO                                                     'The+magic+constant+__DIR__+seems+to+be+defined.%0A%0A'
   37    27    >   ECHO                                                     'Finally%2C+here+is+the+result+of+var_dump%28__DIR__%29%3A%0A'
   38    28        INIT_FCALL                                               'var_dump'
         29        SEND_VAL                                                 '%2Fin'
         30        DO_ICALL                                                 
         31      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.07 ms | 1400 KiB | 19 Q