<?php $lookup = ['neither', 'upper', 'lower']; $tests = ['A', 'z', '+', '0', 'ǻ', 'Ͱ', null]; foreach ($tests as $test) { if (preg_match('~(\p{Lu})|(\p{Ll})~u', $test, $out)) { end($out); // advance pointer to final element $index = key($out); } else { $index = 0; } echo "{$test}: {$lookup[$index]}\n"; }
You have javascript disabled. You will not be able to edit any code.