Core PHP

Basic String Functions

Basic String Functions
chr()
string chr(int $iAscii)
This function returns a string with a single character in it that is the ascii character equivalent of integer value $iAscii.
Argument Description
int $iAscii This is the integer value of the ascii character.
count_chars()
various count_chars(string $sOriginal, integer $iMode = 0)
This function returns the number of occurrences of each character byte value (0-255) in the $sOriginal string or a variant of that, depending on $iMode as follows:
  • 0 - An array with each ASCII value as its key and the frequency as its value
  • 1 - The same array with zero values omitted
  • 2 - The same array with nonzero values omitted
  • 3 - A string of the used characters
  • 4 - A string of characters which are not used
Argument Description
string $sOriginal This is the original string that is being analyzed.
int $iMode This is the mode; its values and effects are described above.
ord()
int ord(string $sAsciiChar)
This function returns the numeric ASCII value of the first character of $sAsciiChar.
Argument Description
string $sAsciiChar This is a string that will be converted.
str_repeat()
string str_repeat(string $sOriginal, integer $iTimes)
This function returns a string that contains the string $sOriginal repeated $iTimes.
Argument Description
string $sOriginal This is the original string that is being repeated.
int $iTimes This is the number of times that the string is repeated.
str_shuffle()
string str_shuffle(string $sOriginal)
This function returns a string that contains a permutation of the characters of the string $sOriginal.
Argument Description
string $sOriginal This is the original string that is being shuffled.
str_word_count()
various str_word_count(string $sOriginal, integer $iMode = 0, string $sCharSet = "")
This function returns the number of words in the string $sOriginal, depending on $iMode as follows:
  • 0 - Output the number of words found.
  • 1 - Output an array of the words found.
  • 2 - Output an associative array of the words found with the keys set to the position of each word in the string.
Argument Description
string $sOriginal This is the original string that is being analyzed.
int $iMode This is the mode; its values and effects are described above.
string $sCharSet This is a set of characters that are consider part of a word, in addition to the letters characters.
strlen()
integer strlen(string $sString)
This function returns the number of characters in the string $sString..
Argument Description
string $sString This is a string that will be measured.
strrev()
string strrev(string $sOriginal)
This function returns a string of the character in string $sOriginal in the reverse order.
Argument Description
string $sOriginal This is the original string that is being reversed.
 
 

© 2007–2024 XoaX.net LLC. All rights reserved.