Name splitter library? |
Hello people!
I just want to know if there's an existing PHP library file (for CodeIgniter or maybe a vanilla PHP) that splits a full name into parts: i.e: Bond, James E. returns PHP Code: array( I found this library called PHP Name Parser (https://github.com/joshfraser/PHP-Name-Parser), but it doesn't fit to my requirements. It actually works but the "LastName, FirstName MiddleName" pattern don't work with the library. Thanks in advance.. Hope someone can help me.
This one seems quite complete and handles middle names https://github.com/theiconic/name-parser
Haven't used it myself.
The tool is great. But we have a problem.
I test the library with this name: "John James E. Bond". The result returns like this: PHP Code: array( I've already installed that to my project via Composer. (08-10-2018, 12:59 AM)Pertti Wrote:(08-09-2018, 08:56 PM)kaitenz Wrote: The result returns like this: The ['firstName'] should return as "John James". The ['middleName'] should return "E." and ['lastName'] should return "Bond".
@kaitenz
example 001: Bond, James E. example 002: John James E. Bond" First example has surname first and second example has surname last! Reminds me of: https://en.wikipedia.org/wiki/Garbage_in,_garbage_out It would help if there was a full list of possible names. PHP Code: echo '', $str = "John James E. Bond"; Output: Quote:John James E. Bond |
Welcome Guest, Not a member yet? Register Sign In |