3v4l.org

run code in 500+ PHP versions simultaneously
<?php define('MYPLUGIN_VERSION', '%%VERSION%%'); function get_plugin_version(): string { static $ver; if (!isset($ver)) { // Allow development in non-built versions via env var. // This can also be used in CI or anyway in tests $tryVer = (defined('MYPLUGIN_VERSION') && !str_starts_with(\MYPLUGIN_VERSION, '%%')) ? (string) \MYPLUGIN_VERSION : getenv('MYPLUGIN_VERSION'); if ($tryVer === false) { throw new \Exception("Please use a built version or set MYPLUGIN_VERSION env var"); } $ver = $tryVer; } return $ver; } try { get_plugin_version(); } catch (\Throwable) { echo "Failed first time, try again:\n"; putenv('MYPLUGIN_VERSION=1.0.0'); echo 'Plugin version is: ' . get_plugin_version(); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 7
Branch analysis from position: 7
2 jumps found. (Code = 107) Position 1 = 8, Position 2 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YaGJg
function name:  (null)
number of ops:  17
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                                   'define'
          1        SEND_VAL                                                     'MYPLUGIN_VERSION'
          2        SEND_VAL                                                     '%25%25VERSION%25%25'
          3        DO_ICALL                                                     
   23     4        INIT_FCALL                                                   'get_plugin_version'
          5        DO_FCALL                                          0          
          6      > JMP                                                          ->16
   24     7  E > > CATCH                                           last         'Throwable'
   25     8    >   ECHO                                                         'Failed+first+time%2C+try+again%3A%0A'
   26     9        INIT_FCALL                                                   'putenv'
         10        SEND_VAL                                                     'MYPLUGIN_VERSION%3D1.0.0'
         11        DO_ICALL                                                     
   27    12        INIT_FCALL                                                   'get_plugin_version'
         13        DO_FCALL                                          0  $3      
         14        CONCAT                                               ~4      'Plugin+version+is%3A+', $3
         15        ECHO                                                         ~4
   28    16    > > RETURN                                                       1

Function get_plugin_version:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 27
Branch analysis from position: 4
2 jumps found. (Code = 46) Position 1 = 6, Position 2 = 10
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 15
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 26
Branch analysis from position: 22
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 26
Branch analysis from position: 22
Branch analysis from position: 26
Branch analysis from position: 10
Branch analysis from position: 27
filename:       /in/YaGJg
function name:  get_plugin_version
number of ops:  31
compiled vars:  !0 = $ver, !1 = $tryVer
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    6     0  E >   BIND_STATIC                                                  !0
    7     1        ISSET_ISEMPTY_CV                                     ~2      !0
          2        BOOL_NOT                                             ~3      ~2
          3      > JMPZ                                                         ~3, ->27
   10     4    >   DEFINED                                              ~4      'MYPLUGIN_VERSION'
          5      > JMPZ_EX                                              ~4      ~4, ->10
          6    >   FETCH_CONSTANT                                       ~5      'MYPLUGIN_VERSION'
          7        FRAMELESS_ICALL_2                str_starts_with      ~6      ~5, '%25%25'
          8        BOOL_NOT                                             ~7      ~6
          9        BOOL                                                 ~4      ~7
         10    > > JMPZ                                                         ~4, ->15
   11    11    >   FETCH_CONSTANT                                       ~8      'MYPLUGIN_VERSION'
         12        CAST                                              6  ~9      ~8
         13        QM_ASSIGN                                            ~10     ~9
         14      > JMP                                                          ->19
   12    15    >   INIT_FCALL                                                   'getenv'
         16        SEND_VAL                                                     'MYPLUGIN_VERSION'
         17        DO_ICALL                                             $11     
         18        QM_ASSIGN                                            ~10     $11
   10    19    >   ASSIGN                                                       !1, ~10
   13    20        TYPE_CHECK                                        4          !1
         21      > JMPZ                                                         ~13, ->26
   14    22    >   NEW                                                  $14     'Exception'
         23        SEND_VAL_EX                                                  'Please+use+a+built+version+or+set+MYPLUGIN_VERSION+env+var'
         24        DO_FCALL                                          0          
         25      > THROW                                             0          $14
   16    26    >   ASSIGN                                                       !0, !1
   19    27    >   VERIFY_RETURN_TYPE                                           !0
         28      > RETURN                                                       !0
   20    29*       VERIFY_RETURN_TYPE                                           
         30*     > RETURN                                                       null

End of function get_plugin_version

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
163.28 ms | 1599 KiB | 18 Q