Cameron Garnett/Testpage8
Contents
Super Quick PHP Tutorial
Introduction | Basic Syntax | Sending Data to the Browser | Comments | Variables | Strings | Functions | Quotes | Debugging | Form
Learning ObjectivesBy the end of this page you will understand what a string is and a few basic commands that you can use to manipulate strings. |
Strings
A string is a sentence or phrase like "I am the greatest!".
In this next example I will show you the difference between the concatenation operator and adding two strings together.
The next example is how to return the length of a string using the strlen() function.
Example<?php |
The next example is how to return how many words in a string using the str_word_count function.
Example<?php |
The next example works similar to javascript splitting a string into an array using the str_split() function.
Example<?php |
ACTIVITYTry writing the example blocks of code into notepad ++ and bare witness to the amazing power of PHP. |