codeigniter Play with English word with INFLECTOR helper Remove / Add delimiter between words


Remove delimiter

The function humanize($words), takes multiple words separated by underscores and adds spaces for underscores with capitalized each word.

echo humanize('mac_donald'); // Prints 'Mac Donald'

The function can also replace any declared separator/delimiter. In this case, delimiter will be second parameter.

echo humanize('mac-donald','-'); // Prints 'Mac Donald'

echo humanize('mac#donald','#'); // Prints 'Mac Donald'

Add Underscore

On the other hand, underscore($words) function replace the space between words with underscore(_).

echo underscore('Mac Donald'); // Prints 'mac_donald'