Home and Learn: PHP Programming Course


PHP String functions

 

Instead of detailing all the possible string functions you can use, we'll just give you a brief list. (There's loads of them!) There's an example of how to use each string function, if you click on the links below. Just dip in to them as and when needed.

chr( ) Convert an ASCII value to a its equivalent character

ord( ) Find out what the ASCII value of a character is

echo( ) An alternative to the print statement

similar_text( ) Tells you how similar two strings of text are

str_repeat( ) Repeat a character a specified number of times

str_replace( ) Replace one string with another

str_word_count( ) Tells you how many words a string has

strlen( ) Gets the length of a string

substr( ) Grab a number of character from a string

 

Some more examples of string functions can be found on these external sites:

http://php.net/manual/en/ref.strings.php

In the next section, we'll take a look at PHP Functions: what they are, and how to create your own.

<-- Back One Page | Move on to the Next Part -->

Back to the PHP Contents Page

 

Email us: enquiry at homeandlearn.co.uk