Several important functions are used for working with strings, and there are many more less-frequently used ones for which there is not enough space here. We are going to look at the most important here, ordered by difficulty—easiest first!
The easiest function is
strlen(), which takes a string as its parameter and returns the number of characters in there, like this:
<?php $ourstring = " The Quick Brown Box Jumped Over The Lazy Dog "; echo strlen($ourstring);?>
We will be using that same string in subsequent examples to save space. If you execute that script, it outputs
48 because 48 characters are in the string. Note the two spaces on either side of the text, which pad the 44-character phrase up to ...