3v4l.org

run code in 300+ PHP versions simultaneously
<?php $lookup = ['neither', 'upper', 'lower']; $tests = ['A', 'z', '+', '0', 'ǻ', 'Ͱ', null]; foreach ($tests as $test) { $index = preg_match('~(\p{Lu})|(\p{Ll})~u', $test, $out) ? array_key_last($out) : 0; echo "{$test}: {$lookup[$index]}\n"; }

preferences:
29.16 ms | 402 KiB | 5 Q