Concept
How can you extract substrings from a string in PHP?
ComputerScienceOne / Comparisons
"43. Strings 1 $name = \"Thomas Alan Waits\"; 2 3 $firstName = substr($name, 0, 6); //\"Thomas\" 4 $middleName = substr($name, 7, 4); //\"Alan\" 5 $lastName = substr($name, 12); //\"Waits\" In 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 · Arrays of Strings
- How can you compute a substring in PHP?ComputerScienceOne · String Functions
- How can you compute a substring of a string?ComputerScienceOne · Arrays of Strings
- How can PHP split strings into tokens using explode() and preg_split()?ComputerScienceOne · Tokenizing
- How can you determine the length of a PHP string?ComputerScienceOne · String Functions
- What are PHP strings and how should they be treated?ComputerScienceOne · Basics
- How can you add or remove characters from a PHP string?ComputerScienceOne · String Functions
- How are PHP strings copied and modified by character?ComputerScienceOne · Basics