Chapter
String Functions
From ComputerScienceOne by Dr Chris Bourke
Concepts
- How can you add or remove characters from a PHP string?
"The last line extends the string by adding an additional character. You can even remove characters by setting them to the empty string.\n\n1 $a = \"Apples!\";\n\n2 $a[5] = \"\";\n\n3 //a is now \"App
- How can you determine the length of a PHP string?
"PHP provides dozens of convenient functions that allow you to process and modify strings. We highlight a few of the more common ones here. A full list of supported functions can be found in standard
- How do you concatenate strings in PHP?
"PHP has a concatenation operator built into the language. To concatenate one or more strings together, you can use a simple period between them as the concatenation operator. Concatenation results in
- How can you compute a substring in PHP?
"PHP provides a simple function, substr() to compute a substring of a string. It takes at at least 2 arguments: the string to operate on and the starting index. There is a third, optional parameter th