Arrays
|
|
|
|
<?php
$name = preg_split("/[s]+/", "$FullName");
if (empty($name[2])) // If there's no third name present,
//we'll assume we've received
// only the first and last name
{
$FirstName= ("$name[0]");
$LastName= stripslashes("$name[1]"); // stripslashes because
//we love the Irish
}
else // If there is a third name present,
// we'll assume the 2nd position is the
// middle initial, which we'll drop for the form entry.
{
$FirstName= ("$name[0]"); // Allow multiple name entries
// so Jay L. De La Cruz, Jr. doesn't
// feel slighted.
$LastName= stripslashes(("$name[2]" . " " . "$name[3]" . " " . "$name[4]" . " " . "$name[5]"));
} ?>
|
|
|
Usage Example
|
|
|
Rate This Script
|
|
|
|