Let’s take a look at PHP string and how it can be used, we will go through three different ways you can use it and with three examples.
First PHP String is strlen, with this one we can count how many keystrokes there is (its even count’s spaces) So do you give it a value so will in count it.
So in this example, we will feed strlen with count keystrokes.
echo strlen("count keystrokes");
The output will be 16
Second PHP String is str_word_count as the name says, it will count word the given value contains. So in this example, we will reuse the work count keystrokes.
//Count the words
echo str_word_count("count keystrokes"); // outputs 2
The output will be 2
In our third and last example of PHP String, we will use strrev.
This turns on the whole value the end becomes first and first becomes last
//flips the words
echo strrev("count keystrokes"); // outputs !dlrow olleH
The output will be !dlrow olleH
And that’s it for this time, hope you enjoy post PHP Strings.