<?php $name = 'Ray Harris'; $i = strpos($name, ' '); if ($i === false) { $message = 'No spaces were found in the name.'; } else { $first_name = substr($name, 0, $i); // $first_name = Ray $last_name = substr($name, $i+1); // $last_name = Harris } ?>
Back