Tutorial by Examples

To use the method of inflector helper, first load the helper like all other helper with the following code: $this->load->helper('inflector');
Function singular($string), convert a plural word to singular. To get perfect result parameter $string should be a single word. The function will return string. echo singular("books"); //prints 'book'
is_countalbe($string) is use for checking a word has plural form or not. Return type will be boolean means if the given word has plural form it will return true, otherwise will return false. is_countable('book'); // Returns TRUE
For getting plural form of any English word the plural($string) function is handy. Like singular($string), the function plural($string) also return string result. echo plural("book"); //prints 'books'
Camel Case is the practise of writing compound words or phrases where every word begins with Capital letter, without space between word. The function camelize($string) helps to make a string camelized. It converts a string of words separated by spaces or underscores to camel case. echo camelize('Mc...
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 w...

Page 1 of 1