3v4l.org

run code in 300+ PHP versions simultaneously
<?php $values = [ 'not-valid-holidays', '$-holidays', '2009--holidays', '2009-A-holidays', '20091-holidays', '2009-999-holidays', 'test/99-holidays', 'test/99/test-holidays', '190-20-holidays', '0-0-holidays', '99-0-holidays', '0-99-holidays', '9999-99-holidays', '2004-holidays', ]; $patterns = [ '.+', '[-\w]+', '[-\d]+', '\d{1,4}(-\d{1,2})?' ]; foreach ($patterns as $pattern) { echo 'Pattern: ' . $pattern . \PHP_EOL; foreach ($values as $string) { echo $string . ': ' . (preg_match('/^' . $pattern. '-holidays$/', $string) ? '✓' : 'X') . \PHP_EOL; } echo \PHP_EOL; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 27
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 27
Branch analysis from position: 4
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 24
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 24
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 19
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 24
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
filename:       /in/c712H
function name:  (null)
number of ops:  29
compiled vars:  !0 = $values, !1 = $patterns, !2 = $pattern, !3 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   20     1        ASSIGN                                                   !1, <array>
   28     2      > FE_RESET_R                                       $6      !1, ->27
          3    > > FE_FETCH_R                                               $6, !2, ->27
   29     4    >   CONCAT                                           ~7      'Pattern%3A+', !2
          5        CONCAT                                           ~8      ~7, '%0A'
          6        ECHO                                                     ~8
   30     7      > FE_RESET_R                                       $9      !0, ->24
          8    > > FE_FETCH_R                                               $9, !3, ->24
   31     9    >   CONCAT                                           ~10     !3, '%3A+'
         10        INIT_FCALL                                               'preg_match'
         11        CONCAT                                           ~11     '%2F%5E', !2
         12        CONCAT                                           ~12     ~11, '-holidays%24%2F'
         13        SEND_VAL                                                 ~12
         14        SEND_VAR                                                 !3
         15        DO_ICALL                                         $13     
         16      > JMPZ                                                     $13, ->19
         17    >   QM_ASSIGN                                        ~14     '%E2%9C%93'
         18      > JMP                                                      ->20
         19    >   QM_ASSIGN                                        ~14     'X'
         20    >   CONCAT                                           ~15     ~10, ~14
         21        CONCAT                                           ~16     ~15, '%0A'
         22        ECHO                                                     ~16
   30    23      > JMP                                                      ->8
         24    >   FE_FREE                                                  $9
   33    25        ECHO                                                     '%0A'
   28    26      > JMP                                                      ->3
         27    >   FE_FREE                                                  $6
   34    28      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.12 ms | 1011 KiB | 14 Q