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);
    }