inflector_helper.php
This file is part of CodeIgniter 4 framework.
(c) CodeIgniter Foundation admin@codeigniter.com
For the full copyright and license information, please view the LICENSE file that was distributed with this source code.
Table of Contents
Functions
- singular() : string
- Singular
- plural() : string
- Plural
- counted() : string
- Counted
- camelize() : string
- Camelize
- pascalize() : string
- Pascalize
- underscore() : string
- Underscore
- decamelize() : string
- Decamelize
- humanize() : string
- Humanize
- is_pluralizable() : bool
- Checks if the given word has a plural version.
- dasherize() : string
- Replaces underscores with dashes in the string.
- ordinal() : string
- Returns the suffix that should be added to a number to denote the position in an ordered sequence such as 1st, 2nd, 3rd, 4th.
- ordinalize() : string
- Turns a number into an ordinal string used to denote the position in an ordered sequence such as 1st, 2nd, 3rd, 4th.
Functions
singular()
Singular
singular(string $string) : string
Takes a plural word and makes it singular
Parameters
- $string : string
-
Input string
Return values
stringplural()
Plural
plural(string $string) : string
Takes a singular word and makes it plural
Parameters
- $string : string
-
Input string
Return values
stringcounted()
Counted
counted(int $count, string $string) : string
Takes a number and a word to return the plural or not E.g. 0 cats, 1 cat, 2 cats, ...
Parameters
- $count : int
-
Number of items
- $string : string
-
Input string
Return values
stringcamelize()
Camelize
camelize(string $string) : string
Takes multiple words separated by spaces or underscores and converts them to camel case.
Parameters
- $string : string
-
Input string
Return values
stringpascalize()
Pascalize
pascalize(string $string) : string
Takes multiple words separated by spaces or underscores and converts them to Pascal case, which is camel case with an uppercase first letter.
Parameters
- $string : string
-
Input string
Return values
stringunderscore()
Underscore
underscore(string $string) : string
Takes multiple words separated by spaces and underscores them
Parameters
- $string : string
-
Input string
Return values
stringdecamelize()
Decamelize
decamelize(string $string) : string
Takes multiple words separated by camel case and underscores them.
Parameters
- $string : string
-
Input string
Return values
stringhumanize()
Humanize
humanize(string $string[, string $separator = '_' ]) : string
Takes multiple words separated by the separator, camelizes and changes them to spaces
Parameters
- $string : string
-
Input string
- $separator : string = '_'
-
Input separator
Return values
stringis_pluralizable()
Checks if the given word has a plural version.
is_pluralizable(string $word) : bool
Parameters
- $word : string
-
Word to check
Return values
booldasherize()
Replaces underscores with dashes in the string.
dasherize(string $string) : string
Parameters
- $string : string
-
Input string
Return values
stringordinal()
Returns the suffix that should be added to a number to denote the position in an ordered sequence such as 1st, 2nd, 3rd, 4th.
ordinal(int $integer) : string
Parameters
- $integer : int
-
The integer to determine the suffix
Return values
stringordinalize()
Turns a number into an ordinal string used to denote the position in an ordered sequence such as 1st, 2nd, 3rd, 4th.
ordinalize(int $integer) : string
Parameters
- $integer : int
-
The integer to ordinalize