3v4l.org

run code in 300+ PHP versions simultaneously
<?php function isReserved($string = '') { $reserved_pattern = "/\b((a(bstract|nd|rray|s))|(c(a(llable|se|tch)|l(ass|one)|on(st|tinue)))|(d(e(clare|fault)|ie|o))|(e(cho|lse(if)?|mpty|nd(declare|for(each)|if|switch|while)|val|x(it|tends)))|(f(inal|or(each)?|unction))|(g(lobal|oto))|(i(f|mplements|n(clude(_once)?|st(anceof|eadof)|terface)|sset))|(n(amespace|ew))|(p(r(i(nt|vate)|otected)|ublic))|(re(quire(_once)?|turn))|(s(tatic|witch))|(t(hrow|r(ait|y)))|(u(nset|se))|(__halt_compiler|break|list|(x)?or|var|while))\b/"; return preg_match($reserved_pattern, $string); } echo 'static'; echo PHP_EOL; echo isReserved('static'); echo PHP_EOL; echo PHP_EOL; echo 'hello'; echo PHP_EOL; echo isReserved('hello');

preferences:
24.88 ms | 404 KiB | 5 Q