3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $clientContactName = "Annelie Sterling"; $split = preg_split('/ /', $clientContactName); if(count($split) >= 2) { //no point in trying to match if we don't have both a first and last name $firstname = trim(implode("", array_splice($split,0,1))); $lastname = trim(implode("",$split)); } echo $firstname; echo "\n"; echo $lastname;
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Annelie Sterling