3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $aTest = array('apple', 'pineapple', 'banana', 'kiwi', 'pear', 'strawberry', '1234', '#qwerty', '!qwerty'); $range = range('A','Z'); $range[] = "#"; $output = array(); foreach($aTest AS $fruit){ $uc = ucfirst($fruit); if(array_search($uc[0], $range) === FALSE){ $output['#'][] = $uc; } else { $output[$uc[0]][] = $uc; } }
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0