peterkahl/name-string-order

Orders a person's name as 'First Last', 'First Middle Last', 'Last First', and extracts 'First', 'Last' and 'Middle'.

v2.0.1 2018-03-22 15:35 UTC

README

Attempts to order a person's name as 'First Last', 'First Middle Last', 'Last First', and extracts 'First', 'Last' and 'Middle'.

Usage

Romanized Chinese name:

use peterkahl\nameStringOrder\nameStringOrder;

$nameObj = new nameStringOrder('WANG jing-jing');

echo $nameObj->getFirstLast(); # Jing-Jing Wang

echo $nameObj->getLastFirst(); # Wang Jing-Jing

echo $nameObj->getFirst();     # Jing-Jing

echo $nameObj->getLast();      # Wang

Russian name:

use peterkahl\nameStringOrder\nameStringOrder;

$nameObj = new nameStringOrder('Владимир Владимирович Путин');

echo $nameObj->getFirstLast();       # Владимир Путин

echo $nameObj->getLastFirst();       # Путин Владимир

echo $nameObj->getFirstMiddleLast(); # Владимир Владимирович Путин

echo $nameObj->getFirst();           # Владимир

echo $nameObj->getMiddle();          # Владимирович

echo $nameObj->getLast();            # Путин

Chinese name:

use peterkahl\nameStringOrder\nameStringOrder;

$nameObj = new nameStringOrder('艾未未');

echo $nameObj->getFirst();     # 未未

echo $nameObj->getLast();      #

Latin character name:

use peterkahl\nameStringOrder\nameStringOrder;

$nameObj = new nameStringOrder('Curie Marie');

echo $nameObj->getFirstLast(); # Marie Curie

echo $nameObj->getLastFirst(); # Curie Marie

echo $nameObj->getFirst();     # Marie

echo $nameObj->getLast();      # Curie