93 $this->titles = array(
'dr',
'doctor',
'miss',
'misses',
'mr',
'mister',
'mrs',
'ms',
'judge',
'sir',
'madam',
'madame',
'AB',
'2ndLt',
'Amn',
'1stLt',
'A1C',
'Capt',
'SrA',
'Maj',
'SSgt',
'LtCol',
'TSgt',
'Col',
'BrigGen',
'1stSgt',
'MajGen',
'SMSgt',
'LtGen',
'1stSgt',
'Gen',
'CMSgt',
'1stSgt',
'CCMSgt',
'CMSAF',
'PVT',
'2LT',
'PV2',
'1LT',
'PFC',
'CPT',
'SPC',
'MAJ',
'CPL',
'LTC',
'SGT',
'COL',
'SSG',
'BG',
'SFC',
'MG',
'MSG',
'LTG',
'1SGT',
'GEN',
'SGM',
'CSM',
'SMA',
'WO1',
'WO2',
'WO3',
'WO4',
'WO5',
'ENS',
'SA',
'LTJG',
'SN',
'LT',
'PO3',
'LCDR',
'PO2',
'CDR',
'PO1',
'CAPT',
'CPO',
'RADM(LH)',
'SCPO',
'RADM(UH)',
'MCPO',
'VADM',
'MCPOC',
'ADM',
'MPCO-CG',
'CWO-2',
'CWO-3',
'CWO-4',
'Pvt',
'2ndLt',
'PFC',
'1stLt',
'LCpl',
'Capt',
'Cpl',
'Maj',
'Sgt',
'LtCol',
'SSgt',
'Col',
'GySgt',
'BGen',
'MSgt',
'MajGen',
'1stSgt',
'LtGen',
'MGySgt',
'Gen',
'SgtMaj',
'SgtMajMC',
'WO-1',
'CWO-2',
'CWO-3',
'CWO-4',
'CWO-5',
'ENS',
'SA',
'LTJG',
'SN',
'LT',
'PO3',
'LCDR',
'PO2',
'CDR',
'PO1',
'CAPT',
'CPO',
'RDML',
'SCPO',
'RADM',
'MCPO',
'VADM',
'MCPON',
'ADM',
'FADM',
'WO1',
'CWO2',
'CWO3',
'CWO4',
'CWO5');
95 $this->prefices = array(
'bon',
'ben',
'bin',
'da',
'dal',
'de',
'del',
'der',
'de',
'e',
'la',
'le',
'san',
'st',
'ste',
'van',
'vel',
'von');
96 $this->suffices = array(
'esq',
'esquire',
'jr',
'sr',
'2',
'i',
'ii',
'iii',
'iv',
'v',
'clu',
'chfc',
'cfp',
'md',
'phd');
98 $this->notParseable =
false;
101 if ($initString !=
"") {
102 $this->fullName = $initString;
191 $this->fullName = $newFullName;
205 $needle = trim(strtolower(str_replace(
'.',
'', $needle)));
206 return in_array($needle, $haystack);
224 $this->notParseable =
false;
227 $pieces = explode(
',', preg_replace(
'/\s+/',
' ', trim($this->fullName)));
228 $numPieces = count($pieces);
230 switch ($numPieces) {
234 $subPieces = explode(
' ', trim($pieces[0]));
235 $numSubPieces = count($subPieces);
236 for (
$i = 0;
$i < $numSubPieces;
$i++) {
238 if ($i < ($numSubPieces - 1)) {
239 $next = trim($subPieces[$i + 1]);
247 if ($this->first ==
"") {
251 if ($i == $numSubPieces - 2 && ($next !=
"") && $this->
inArrayNorm($next, $this->suffices)) {
252 if ($this->last !=
"") {
257 $this->suffix = $next;
260 if ($i == $numSubPieces - 1) {
261 if ($this->last !=
"") {
269 if ($this->last !=
"") {
276 if ($next ==
'y' || $next ==
'Y') {
277 if ($this->last !=
"") {
284 if ($this->last !=
"") {
288 if ($this->middle !=
"") {
297 switch ($this->
inArrayNorm($pieces[1], $this->suffices)) {
301 $subPieces = explode(
' ', trim($pieces[0]));
302 $numSubPieces = count($subPieces);
303 for (
$i = 0;
$i < $numSubPieces;
$i++) {
305 if ($i < ($numSubPieces - 1)) {
306 $next = trim($subPieces[$i + 1]);
314 if ($this->first ==
"") {
318 if ($i == $numSubPieces - 1) {
319 if ($this->last !=
"") {
327 if ($this->last !=
"") {
334 if ($next ==
'y' || $next ==
'Y') {
335 if ($this->last !=
"") {
342 if ($this->last !=
"") {
346 if ($this->middle !=
"") {
352 $this->suffix = trim($pieces[1]);
353 for (
$i = 2;
$i < $numPieces;
$i++) {
354 $this->suffix .=
", " . trim($pieces[
$i]);
360 $subPieces = explode(
' ', trim($pieces[1]));
361 $numSubPieces = count($subPieces);
362 for (
$i = 0;
$i < $numSubPieces;
$i++) {
364 if ($i < ($numSubPieces - 1)) {
365 $next = trim($subPieces[$i + 1]);
373 if ($this->first ==
"") {
377 if ($i == $numSubPieces - 2 && ($next !=
"") && $this->
inArrayNorm($next, $this->suffices)) {
378 if ($this->middle !=
"") {
383 $this->suffix = $next;
390 if ($this->middle !=
"") {
396 if (isset($pieces[2]) && $pieces[2]) {
397 if ($this->last ==
"") {
398 $this->suffix = trim($pieces[2]);
399 for (
$s = 3;
$s < $numPieces;
$s++) {
400 $this->suffix .=
", " . trim($pieces[
$s]);
403 for (
$s = 2;
$s < $numPieces;
$s++) {
404 $this->suffix .=
", " . trim($pieces[
$s]);
408 $this->last = $pieces[0];
414 if ($this->first ==
"" && $this->middle ==
"" && $this->last ==
"") {
415 $this->notParseable =
true;
inArrayNorm($needle, $haystack)
Determine if the needle is in the haystack.
getMiddleName()
Access Method public.
getSuffix()
Access Method public.
getFirstName()
Access Method public.
parse()
Extract the elements of the full name into separate parts.
__destruct()
Destructor public.
__construct($initString="")
Constructor: Setup the object, initialise the variables, and if instantiated with a name - parse it a...
getNotParseable()
Access Method public.
getTitle()
Access Method public.
getLastName()
Access Method public.
setFullName($newFullName)
Mutator Method public.