public function splitName($name, $firstOrSurname="surname") {

        // The first name is considered to be all the characters to the left of the final space.
        // The surname is considered to be all the characters to the right of the final space.

        // oh, just in case the name ends with a space
        $name = trim($name);

        $positionOfFinalSpace = strrpos($name, " ");

        if ($firstOrSurname == "surname") {
            return substr($name, $positionOfFinalSpace+1, strlen($name));
        }

        return substr($name, 0, $positionOfFinalSpace);
    }
public function splitName($name, $firstOrSurname="surname") {

        // The first name is considered to be all the characters to the left of the final space.
        // The surname is considered to be all the characters to the right of the final space.

        // oh, just in case the name ends with a space
        $name = trim($name);

        $positionOfFinalSpace = strrpos($name, " ");

        if ($firstOrSurname == "surname") {
            return substr($name, $positionOfFinalSpace+1, strlen($name));
        }

        return substr($name, 0, $positionOfFinalSpace);
    }
public function splitName ( $ name , $ firstOrSurname = "surname" ) { // The first name is considered to be all the characters to the left of the final space. // The surname is considered to be all the characters to the right of the final space. // oh, just in case the name ends with a space $ name = trim ( $ name ) ; $ positionOfFinalSpace = strrpos ( $ name , " " ) ; if ( $ firstOrSurname == "surname" ) { return substr ( $ name , $ positionOfFinalSpace + 1 , strlen ( $ name ) ) ; } return substr ( $ name , 0 , $ positionOfFinalSpace ) ; }
First name and surnames are combined during registration.
Split 'em and return either the first name or the suranme

@param  string  $name           Name entered during the registration process
@param  string  $firstOrSurname Return the "firstname"; or, the "surname"
@return string
First name and surnames are combined during registration . Split em and return either the first name or the suranme