3v4l.org

run code in 300+ 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 = 30
Branch analysis from position: 4
2 jumps found. (Code = 46) Position 1 = 6, Position 2 = 13
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 18
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 29
Branch analysis from position: 25
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 29
Branch analysis from position: 25
Branch analysis from position: 29
Branch analysis from position: 13
Branch analysis from position: 30
filename:       /in/YaGJg
function name:  get_plugin_version
number of ops:  34
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, ->30
   10     4    >   DEFINED                                          ~4      'MYPLUGIN_VERSION'
          5      > JMPZ_EX                                          ~4      ~4, ->13
          6    >   INIT_FCALL                                               'str_starts_with'
          7        FETCH_CONSTANT                                   ~5      'MYPLUGIN_VERSION'
          8        SEND_VAL                                                 ~5
          9        SEND_VAL                                                 '%25%25'
         10        DO_ICALL                                         $6      
         11        BOOL_NOT                                         ~7      $6
         12        BOOL                                             ~4      ~7
         13    > > JMPZ                                                     ~4, ->18
   11    14    >   FETCH_CONSTANT                                   ~8      'MYPLUGIN_VERSION'
         15        CAST                                          6  ~9      ~8
         16        QM_ASSIGN                                        ~10     ~9
         17      > JMP                                                      ->22
   12    18    >   INIT_FCALL                                               'getenv'
         19        SEND_VAL                                                 'MYPLUGIN_VERSION'
         20        DO_ICALL                                         $11     
         21        QM_ASSIGN                                        ~10     $11
   10    22    >   ASSIGN                                                   !1, ~10
   13    23        TYPE_CHECK                                    4          !1
         24      > JMPZ                                                     ~13, ->29
   14    25    >   NEW                                              $14     'Exception'
         26        SEND_VAL_EX                                              'Please+use+a+built+version+or+set+MYPLUGIN_VERSION+env+var'
         27        DO_FCALL                                      0          
         28      > THROW                                         0          $14
   16    29    >   ASSIGN                                                   !0, !1
   19    30    >   VERIFY_RETURN_TYPE                                       !0
         31      > RETURN                                                   !0
   20    32*       VERIFY_RETURN_TYPE                                       
         33*     > RETURN                                                   null

End of function get_plugin_version

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
259.98 ms | 1016 KiB | 20 Q