3v4l.org

run code in 300+ PHP versions simultaneously
<?php $version = '5.5.58-0ubuntu0.14.04.1'; echo '<pre>'; var_dump(preg_match('/^(?P<major>\d+)(?:\.(?P<minor>\d+)(?:\.(?P<patch>\d+))?)?/', $version, $versionParts)); if (!preg_match('/^(?P<major>\d+)(?:\.(?P<minor>\d+)(?:\.(?P<patch>\d+))?)?/', $version, $versionParts)) { echo "RegEx failed on " . $version . PHP_EOL; } else { echo "RegEx extracted version parts" . PHP_EOL; var_dump($versionParts); } function errorValue($error) { return defined($error) ? constant($error) : $error; } $errors = array( 'PREG_NO_ERROR', 'PREG_INTERNAL_ERROR', 'PREG_BACKTRACK_LIMIT_ERROR', 'PREG_RECURSION_LIMIT_ERROR', 'PREG_BAD_UTF8_ERROR', 'PREG_BAD_UTF8_OFFSET_ERROR', 'PREG_JIT_STACKLIMIT_ERROR' ); $pregErrors = array_combine( array_map('errorValue', $errors), $errors ); echo $pregErrors[preg_last_error()] . PHP_EOL; echo '</pre>';
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 21
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d197u
function name:  (null)
number of ops:  42
compiled vars:  !0 = $version, !1 = $versionParts, !2 = $errors, !3 = $pregErrors
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '5.5.58-0ubuntu0.14.04.1'
    4     1        ECHO                                                     '%3Cpre%3E'
    6     2        INIT_FCALL                                               'var_dump'
          3        INIT_FCALL                                               'preg_match'
          4        SEND_VAL                                                 '%2F%5E%28%3FP%3Cmajor%3E%5Cd%2B%29%28%3F%3A%5C.%28%3FP%3Cminor%3E%5Cd%2B%29%28%3F%3A%5C.%28%3FP%3Cpatch%3E%5Cd%2B%29%29%3F%29%3F%2F'
          5        SEND_VAR                                                 !0
          6        SEND_REF                                                 !1
          7        DO_ICALL                                         $5      
          8        SEND_VAR                                                 $5
          9        DO_ICALL                                                 
    7    10        INIT_FCALL                                               'preg_match'
         11        SEND_VAL                                                 '%2F%5E%28%3FP%3Cmajor%3E%5Cd%2B%29%28%3F%3A%5C.%28%3FP%3Cminor%3E%5Cd%2B%29%28%3F%3A%5C.%28%3FP%3Cpatch%3E%5Cd%2B%29%29%3F%29%3F%2F'
         12        SEND_VAR                                                 !0
         13        SEND_REF                                                 !1
         14        DO_ICALL                                         $7      
         15        BOOL_NOT                                         ~8      $7
         16      > JMPZ                                                     ~8, ->21
    8    17    >   CONCAT                                           ~9      'RegEx+failed+on+', !0
         18        CONCAT                                           ~10     ~9, '%0A'
         19        ECHO                                                     ~10
         20      > JMP                                                      ->25
   11    21    >   ECHO                                                     'RegEx+extracted+version+parts%0A'
   12    22        INIT_FCALL                                               'var_dump'
         23        SEND_VAR                                                 !1
         24        DO_ICALL                                                 
   20    25    >   ASSIGN                                                   !2, <array>
   30    26        INIT_FCALL                                               'array_combine'
   31    27        INIT_FCALL                                               'array_map'
         28        SEND_VAL                                                 'errorValue'
         29        SEND_VAR                                                 !2
         30        DO_ICALL                                         $13     
         31        SEND_VAR                                                 $13
   32    32        SEND_VAR                                                 !2
         33        DO_ICALL                                         $14     
   30    34        ASSIGN                                                   !3, $14
   35    35        INIT_FCALL                                               'preg_last_error'
         36        DO_ICALL                                         $16     
         37        FETCH_DIM_R                                      ~17     !3, $16
         38        CONCAT                                           ~18     ~17, '%0A'
         39        ECHO                                                     ~18
   36    40        ECHO                                                     '%3C%2Fpre%3E'
         41      > RETURN                                                   1

Function errorvalue:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 10
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d197u
function name:  errorValue
number of ops:  13
compiled vars:  !0 = $error
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   17     1        INIT_FCALL                                               'defined'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4      > JMPZ                                                     $1, ->10
          5    >   INIT_FCALL                                               'constant'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $2      
          8        QM_ASSIGN                                        ~3      $2
          9      > JMP                                                      ->11
         10    >   QM_ASSIGN                                        ~3      !0
         11    > > RETURN                                                   ~3
   18    12*     > RETURN                                                   null

End of function errorvalue

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.06 ms | 1400 KiB | 27 Q