3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tests = [ 'http://example.com/topic/Funny/G1pdeJm', 'http://example.com/topic/Funny/viral', 'http://example.com/topic/Funny/time', 'http://example.com/topic/Funny/top', 'http://example.com/topic/Funny/top/week', 'http://example.com/topic/Funny/top/month', 'http://example.com/topic/Funny/top/year', 'http://example.com/topic/Funny/top/all', 'http://example.com/topic/NotFunny/IL2dsRq', ]; $result = []; foreach ($tests as $str) { if (preg_match('~^http://[^/]+/topic/Funny/(?!viral|time|top(?:/week|/month|/year|/all)?)~', $str)) { $result[] = $str; } } var_export($result);
Output for 8.1.0 - 8.1.30, 8.2.0 - 8.2.25, 8.3.0 - 8.3.13
array ( 0 => 'http://example.com/topic/Funny/G1pdeJm', )

preferences:
58.04 ms | 406 KiB | 5 Q