3v4l.org

run code in 300+ PHP versions simultaneously
<?php $pattern='/^(\p{Pd}+\s*2\.2\.|2\.2\.)/mu'; $texts = array( "– 2.2.04 R", "–– 2.2.04.10 C", "–– 2.2.04.1 CO", "–– 2.2.04.2 CO", "–– 2.2.04.3 CO", "–– 2.2.04.4 CO", "–– 2.2.04.5 CO", "–– 2.2.04.6 CO", "–– 2.2.04.7 CO", "–– 2.2.04.8 CO", "–– 2.2.04.9 CO", "foooooooooooo", "barrrrrrrrrr", "-- foobar", "- 1123", ); foreach($texts as $key=>$text) { if(preg_match($pattern, $text)) { $final_texts[] = $text; } } print_r($final_texts);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 13
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 13
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 12
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/2h108
function name:  (null)
number of ops:  18
compiled vars:  !0 = $pattern, !1 = $texts, !2 = $text, !3 = $key, !4 = $final_texts
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%2F%5E%28%5Cp%7BPd%7D%2B%5Cs%2A2%5C.2%5C.%7C2%5C.2%5C.%29%2Fmu'
    5     1        ASSIGN                                                   !1, <array>
   23     2      > FE_RESET_R                                       $7      !1, ->13
          3    > > FE_FETCH_R                                       ~8      $7, !2, ->13
          4    >   ASSIGN                                                   !3, ~8
   24     5        INIT_FCALL                                               'preg_match'
          6        SEND_VAR                                                 !0
          7        SEND_VAR                                                 !2
          8        DO_ICALL                                         $10     
          9      > JMPZ                                                     $10, ->12
   25    10    >   ASSIGN_DIM                                               !4
         11        OP_DATA                                                  !2
   23    12    > > JMP                                                      ->3
         13    >   FE_FREE                                                  $7
   29    14        INIT_FCALL                                               'print_r'
         15        SEND_VAR                                                 !4
         16        DO_ICALL                                                 
         17      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.29 ms | 1406 KiB | 17 Q