3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { const VERSION_INFO = '12abc34 (HEAD -> master, tag: 2.0.1)'; static function getVersion(): string { if (self::VERSION_INFO[0] === '$') { // fallback to other methods return ''; } if (preg_match('/^([0-9a-f]+).*?tag: ([\d\.]+)/', self::VERSION_INFO, $matched)) { return "{$matched[2]}-{$matched[1]}"; } // fallback to other methods } } var_dump(Foo::getVersion());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XD2q3
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_STATIC_METHOD_CALL                                  'Foo', 'getVersion'
          2        DO_FCALL                                      0  $0      
          3        SEND_VAR                                                 $0
          4        DO_ICALL                                                 
          5      > RETURN                                                   1

Class Foo:
Function getversion:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 4
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 17
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XD2q3
function name:  getVersion
number of ops:  19
compiled vars:  !0 = $matched
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   FETCH_DIM_R                                      ~1      '12abc34+%28HEAD+-%3E+master%2C+tag%3A+2.0.1%29', 0
          1        IS_IDENTICAL                                             ~1, '%24'
          2      > JMPZ                                                     ~2, ->4
   11     3    > > RETURN                                                   ''
   14     4    >   INIT_FCALL                                               'preg_match'
          5        SEND_VAL                                                 '%2F%5E%28%5B0-9a-f%5D%2B%29.%2A%3Ftag%3A+%28%5B%5Cd%5C.%5D%2B%29%2F'
          6        SEND_VAL                                                 '12abc34+%28HEAD+-%3E+master%2C+tag%3A+2.0.1%29'
          7        SEND_REF                                                 !0
          8        DO_ICALL                                         $3      
          9      > JMPZ                                                     $3, ->17
   15    10    >   FETCH_DIM_R                                      ~4      !0, 2
         11        ROPE_INIT                                     3  ~7      ~4
         12        ROPE_ADD                                      1  ~7      ~7, '-'
         13        FETCH_DIM_R                                      ~5      !0, 1
         14        ROPE_END                                      2  ~6      ~7, ~5
         15        VERIFY_RETURN_TYPE                                       ~6
         16      > RETURN                                                   ~6
   19    17    >   VERIFY_RETURN_TYPE                                       
         18      > RETURN                                                   null

End of function getversion

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.61 ms | 1407 KiB | 17 Q