3v4l.org

run code in 300+ PHP versions simultaneously
<?php $modules = ['redirect_404', 'redirect']; $modules_by_length = $modules; usort($modules_by_length, static fn ($a, $b) => strlen($b) - strlen($a)); $known_modules_pattern = implode('|', array_map( static fn ($x) => preg_quote($x, '/'), $modules_by_length, )); $module_preg = '/^(?<function>(?<module>' . $known_modules_pattern . ')_(?<hook>[a-zA-Z0-9_\x80-\xff]+$))(?<!update_\d)(?<!update_\d\d)(?<!update_\d\d\d)(?<!update_\d\d\d\d)/'; print $module_preg; preg_match($module_preg, 'redirect_404_update_8101', $matches); preg_match($module_preg, 'redirect_404_cron', $matches); var_dump($matches);
Output for 8.2.0 - 8.2.29, 8.3.0 - 8.3.28, 8.4.1 - 8.4.14, 8.5.0 - 8.5.1
/^(?<function>(?<module>redirect_404|redirect)_(?<hook>[a-zA-Z0-9_\x80-\xff]+$))(?<!update_\d)(?<!update_\d\d)(?<!update_\d\d\d)(?<!update_\d\d\d\d)/array(7) { [0]=> string(17) "redirect_404_cron" ["function"]=> string(17) "redirect_404_cron" [1]=> string(17) "redirect_404_cron" ["module"]=> string(12) "redirect_404" [2]=> string(12) "redirect_404" ["hook"]=> string(4) "cron" [3]=> string(4) "cron" }
Output for 8.4.15
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
Process exited with code 1.

preferences:
67.42 ms | 407 KiB | 5 Q