3v4l.org

run code in 300+ PHP versions simultaneously
<?php $paths = [ '/cars$', '.*\/cars$', '^cars\/.*/', '/trucks$', '.*\/trucks$', ]; $paths_string = '#' . implode('|', $paths) . '#'; $current_path = 'cars/honda/'; if (preg_match($paths_string, $current_path)) { echo "it's a match!"; }

preferences:
123.79 ms | 405 KiB | 5 Q