PHP String Handling Functions

PHP String Handling Functions


strlen(string)
– returns the length of a string.


str word_count(string,return,char) – counts the number of words in a string.


strrev(string) – reverses a string.


strpos(string,find,start) – finds the position of the first occurrence of a string inside another string.


str replace(find,replace,string,count) – replaces some characters with some other characters in a string


strstr(string,search,before_search) – searches for the first occurrence of a string inside another string.

substr(string, start,length) – returns a part of a string.


wordwrap(string,width,break,cut) – wraps a string into new lines when it reaches a specific length.


trim(string,charlist) – removes whitespace and other predefined characters from both
sides of a string.


sprintf(format,argı,arg2,arg++) – writes a formatted string to a variable.
Possible format values:
6%/ %b /%c /%d /%e /%E /%u /%f /%F /%g /%G /%o /%s /%x
/%X

Leave a Reply

Your email address will not be published. Required fields are marked *