3v4l.org

run code in 500+ PHP versions simultaneously
<?php $zip_codes = array( '12556', '765547', '234*', '987*' ); $target_zip = '2347890'; foreach( $zip_codes as $zip ) { echo $zip; if (preg_match('/' . str_replace('*', '.*', $zip) . '/', $target_zip)) { echo ' matched'. PHP_EOL; break; } else { echo ' not matched' . PHP_EOL; } }
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.31, 8.4.1 - 8.4.22, 8.5.0 - 8.5.7
12556 not matched 765547 not matched 234* matched

preferences:
88.28 ms | 1507 KiB | 4 Q