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 does PHP compare strings using strcmp()?ComputerScienceOne · Comparisons
- How can you compare strings by their content in PHP?ComputerScienceOne · Arrays of Strings
- How can you compute a substring in PHP?ComputerScienceOne · String Functions
- How do you compare strings in Java?ComputerScienceOne · Comparisons