ujiro2017/fixnames

A code snippet that fixes name input by user. It removes spaces and none word characters and set the first letter in each name to upper case. Arguments are passed by referece.

0.1.1 2023-07-17 12:38 UTC

This package is not auto-updated.

Last update: 2024-12-31 17:36:49 UTC


README

A PHP based function that fixes user inputted names

Requirements

This library requires PHP version 5.0 and above

Install

It is recommended that you install this library using PHP composer. If you don't have composer installed on your machine you can do so by visiting https://www.getcomposer.org/download and follow the instuctions there.

If composer is already installed in your machine, you can install this package by opening the command line terminal and typing the following

composer require jiro2017/Fixnames

How to use

After installing the package on your directory. include composer autoload on your PHP project by doing the following

require_once "vendor/autoload.php";

Next include the FixNames package by writing the following code on the next line after the require_once code.

use function FixNames\fix_names;

You can make use of the fix_names function by calling the following lines of code

$firstname = " John";
$middlename = "doe ";
$surname = "MIKE";

echo "Unfixed names: $surname $firstname $middlename<br>"; // Unfixed Names: Mike John doe  

fix_names($surname, $firstname, $middlename);

echo "Fixed names: $surname $firstname $middlename"; // Fixed Names: Mike John Doe