3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* * This should produce failures when using a version of libpcre older than 8.32 */ // Ignore versions other than 5.3-5.5 if (!preg_match('/^5\.[345]\./', phpversion())) { print "Don't care about this version\n"; exit(0); } preg_match('/((?:a?)*)*c/', 'aac', $matches); if ($matches[1] === 'aa') { print "FAIL\n"; } else { print "PASS\n"; } error_reporting(E_ALL); ob_start(); phpinfo(); $phpinfo = ob_get_clean(); print preg_replace('/.*(PCRE Library Version => .*?$).*/sm', '$1', $phpinfo) . "\n"; exit(0); $tests = array(); $test_string = mb_convert_encoding('&#x0BA8;&#x0BBF;', 'UTF-32', 'HTML-ENTITIES'); print "$test_string\n"; print strlen($test_string) . "\n"; print mb_strlen($test_string, 'UTF-32') . "\n"; $tests['string_length'] = (mb_strlen($test_string, 'UTF-32') === 1); $tests['string_match'] = (preg_match('/^\X$/u', $test_string) === 1); $fails = array(); foreach ($tests as $key => $value) { if ($value === false) { $fails[$key] = $value; } } if (count($fails) > 0) { echo "Failed: " . join(', ', array_keys($fails)) . "\n"; exit(1); } exit(0);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 10
Branch analysis from position: 8
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 20
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 20
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/j4rQK
function name:  (null)
number of ops:  98
compiled vars:  !0 = $matches, !1 = $phpinfo, !2 = $tests, !3 = $test_string, !4 = $fails, !5 = $value, !6 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   INIT_FCALL                                               'preg_match'
          1        SEND_VAL                                                 '%2F%5E5%5C.%5B345%5D%5C.%2F'
          2        INIT_FCALL                                               'phpversion'
          3        DO_ICALL                                         $7      
          4        SEND_VAR                                                 $7
          5        DO_ICALL                                         $8      
          6        BOOL_NOT                                         ~9      $8
          7      > JMPZ                                                     ~9, ->10
    8     8    >   ECHO                                                     'Don%27t+care+about+this+version%0A'
    9     9      > EXIT                                                     0
   12    10    >   INIT_FCALL                                               'preg_match'
         11        SEND_VAL                                                 '%2F%28%28%3F%3Aa%3F%29%2A%29%2Ac%2F'
         12        SEND_VAL                                                 'aac'
         13        SEND_REF                                                 !0
         14        DO_ICALL                                                 
   13    15        FETCH_DIM_R                                      ~11     !0, 1
         16        IS_IDENTICAL                                             ~11, 'aa'
         17      > JMPZ                                                     ~12, ->20
   14    18    >   ECHO                                                     'FAIL%0A'
         19      > JMP                                                      ->21
   16    20    >   ECHO                                                     'PASS%0A'
   18    21    >   INIT_FCALL                                               'error_reporting'
         22        SEND_VAL                                                 32767
         23        DO_ICALL                                                 
   20    24        INIT_FCALL                                               'ob_start'
         25        DO_ICALL                                                 
   21    26        INIT_FCALL                                               'phpinfo'
         27        DO_ICALL                                                 
   22    28        INIT_FCALL                                               'ob_get_clean'
         29        DO_ICALL                                         $16     
         30        ASSIGN                                                   !1, $16
   23    31        INIT_FCALL                                               'preg_replace'
         32        SEND_VAL                                                 '%2F.%2A%28PCRE+Library+Version+%3D%3E+.%2A%3F%24%29.%2A%2Fsm'
         33        SEND_VAL                                                 '%241'
         34        SEND_VAR                                                 !1
         35        DO_ICALL                                         $18     
         36        CONCAT                                           ~19     $18, '%0A'
         37        ECHO                                                     ~19
   24    38      > EXIT                                                     0
   26    39*       ASSIGN                                                   !2, <array>
   27    40*       INIT_FCALL                                               'mb_convert_encoding'
         41*       SEND_VAL                                                 '%26%23x0BA8%3B%26%23x0BBF%3B'
         42*       SEND_VAL                                                 'UTF-32'
         43*       SEND_VAL                                                 'HTML-ENTITIES'
         44*       DO_ICALL                                         $21     
         45*       ASSIGN                                                   !3, $21
   28    46*       NOP                                                      
         47*       FAST_CONCAT                                      ~23     !3, '%0A'
         48*       ECHO                                                     ~23
   29    49*       STRLEN                                           ~24     !3
         50*       CONCAT                                           ~25     ~24, '%0A'
         51*       ECHO                                                     ~25
   30    52*       INIT_FCALL                                               'mb_strlen'
         53*       SEND_VAR                                                 !3
         54*       SEND_VAL                                                 'UTF-32'
         55*       DO_ICALL                                         $26     
         56*       CONCAT                                           ~27     $26, '%0A'
         57*       ECHO                                                     ~27
   32    58*       INIT_FCALL                                               'mb_strlen'
         59*       SEND_VAR                                                 !3
         60*       SEND_VAL                                                 'UTF-32'
         61*       DO_ICALL                                         $29     
         62*       IS_IDENTICAL                                     ~30     $29, 1
         63*       ASSIGN_DIM                                               !2, 'string_length'
         64*       OP_DATA                                                  ~30
   33    65*       INIT_FCALL                                               'preg_match'
         66*       SEND_VAL                                                 '%2F%5E%5CX%24%2Fu'
         67*       SEND_VAR                                                 !3
         68*       DO_ICALL                                         $32     
         69*       IS_IDENTICAL                                     ~33     $32, 1
         70*       ASSIGN_DIM                                               !2, 'string_match'
         71*       OP_DATA                                                  ~33
   35    72*       ASSIGN                                                   !4, <array>
   36    73*       FE_RESET_R                                       $35     !2, ->81
         74*       FE_FETCH_R                                       ~36     $35, !5, ->81
         75*       ASSIGN                                                   !6, ~36
   37    76*       TYPE_CHECK                                    4          !5
         77*       JMPZ                                                     ~38, ->80
   38    78*       ASSIGN_DIM                                               !4, !6
         79*       OP_DATA                                                  !5
   36    80*       JMP                                                      ->74
         81*       FE_FREE                                                  $35
   42    82*       COUNT                                            ~40     !4
         83*       IS_SMALLER                                               0, ~40
         84*       JMPZ                                                     ~41, ->96
   43    85*       INIT_FCALL                                               'join'
         86*       SEND_VAL                                                 '%2C+'
         87*       INIT_FCALL                                               'array_keys'
         88*       SEND_VAR                                                 !4
         89*       DO_ICALL                                         $42     
         90*       SEND_VAR                                                 $42
         91*       DO_ICALL                                         $43     
         92*       CONCAT                                           ~44     'Failed%3A+', $43
         93*       CONCAT                                           ~45     ~44, '%0A'
         94*       ECHO                                                     ~45
   44    95*       EXIT                                                     1
   47    96*       EXIT                                                     0
         97*     > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.81 ms | 1404 KiB | 35 Q