3v4l.org

run code in 500+ PHP versions simultaneously
<?php $zip_codes = array( '12556', '765547', '234*', '987*', '237' ); $target_zip = '2347890'; foreach($zip_codes as $zip ) { $digitsOnly = preg_replace("~^(\d+)\**$~", "$1", $zip); if (strpos($target_zip, $digitsOnly) === 0) { echo "$zip matched $target_zip" . PHP_EOL; break; } else { echo "$zip not matched $target_zip" . PHP_EOL; } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 23
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 23
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 17
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 23
Branch analysis from position: 23
filename:       /in/Thrq5
function name:  (null)
number of ops:  25
compiled vars:  !0 = $zip_codes, !1 = $target_zip, !2 = $zip, !3 = $digitsOnly
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
    4     1        ASSIGN                                                       !1, '2347890'
    6     2      > FE_RESET_R                                           $6      !0, ->23
          3    > > FE_FETCH_R                                                   $6, !2, ->23
    7     4    >   FRAMELESS_ICALL_3                preg_replace        ~7      '%7E%5E%28%5Cd%2B%29%5C%2A%2A%24%7E', '%241'
          5        OP_DATA                                                      !2
          6        ASSIGN                                                       !3, ~7
    8     7        FRAMELESS_ICALL_2                strpos              ~9      !1, !3
          8        IS_IDENTICAL                                                 ~9, 0
          9      > JMPZ                                                         ~10, ->17
    9    10    >   ROPE_INIT                                         3  ~12     !2
         11        ROPE_ADD                                          1  ~12     ~12, '+matched+'
         12        ROPE_END                                          2  ~11     ~12, !1
         13        CONCAT                                               ~14     ~11, '%0A'
         14        ECHO                                                         ~14
   10    15      > JMP                                                          ->23
    8    16*       JMP                                                          ->22
   13    17    >   ROPE_INIT                                         3  ~16     !2
         18        ROPE_ADD                                          1  ~16     ~16, '+not+matched+'
         19        ROPE_END                                          2  ~15     ~16, !1
         20        CONCAT                                               ~18     ~15, '%0A'
         21        ECHO                                                         ~18
    6    22      > JMP                                                          ->3
         23    >   FE_FREE                                                      $6
   15    24      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
163.87 ms | 2141 KiB | 13 Q