Concept
How can you extract substrings from a string in PHP?
ComputerScienceOne / Arrays of Strings
"$name = \"Thomas Alan Waits\";\n\n$firstName = substr($name, 0, 6); //\"Thomas\"\n\n$middleName = substr($name, 7, 4); //\"Alan\"\n\n$lastName = substr($name, 12); //\"Waits\"\n\nIn the final example, omitting the optional length parameter results in the entire remainder of the string being returned as the substring."
Related Ideas
- How can you extract substrings from a string in PHP?ComputerScienceOne · Comparisons
- How can you compute a substring in PHP?ComputerScienceOne · String Functions
- How can you compute a substring of a string?ComputerScienceOne · Arrays of Strings
- What are PHP strings and how should they be treated?ComputerScienceOne · Basics
- How can you determine the length of a PHP string?ComputerScienceOne · String Functions
- How can you create and reassign strings in PHP?ComputerScienceOne · Basics
- How can PHP split strings into tokens using explode() and preg_split()?ComputerScienceOne · Tokenizing
- How can you add or remove characters from a PHP string?ComputerScienceOne · String Functions