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) { $value = constant($error); return $value !== null ? $value : $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/d4TAW
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                                                 
   22    25    >   ASSIGN                                                   !2, <array>
   32    26        INIT_FCALL                                               'array_combine'
   33    27        INIT_FCALL                                               'array_map'
         28        SEND_VAL                                                 'errorValue'
         29        SEND_VAR                                                 !2
         30        DO_ICALL                                         $13     
         31        SEND_VAR                                                 $13
   34    32        SEND_VAR                                                 !2
         33        DO_ICALL                                         $14     
   32    34        ASSIGN                                                   !3, $14
   37    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
   38    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 = 7, Position 2 = 9
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d4TAW
function name:  errorValue
number of ops:  12
compiled vars:  !0 = $error, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   17     1        INIT_FCALL                                               'constant'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $2      
          4        ASSIGN                                                   !1, $2
   19     5        TYPE_CHECK                                  1020          !1
          6      > JMPZ                                                     ~4, ->9
          7    >   QM_ASSIGN                                        ~5      !1
          8      > JMP                                                      ->10
          9    >   QM_ASSIGN                                        ~5      !0
         10    > > RETURN                                                   ~5
   20    11*     > RETURN                                                   null

End of function errorvalue

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.85 ms | 1400 KiB | 25 Q