Chapter

Comparisons

From ComputerScienceOne by Dr Chris Bourke

Concepts

  1. How can you extract substrings from a string in PHP?

    "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 fin

  2. How can you create and use arrays of strings in PHP?

    "43.3. Arrays of Strings We often need to deal with collections of strings. In PHP we can define arrays of strings. Indeed, we’ve seen arrays of strings before. When processing command line arguments,

  3. How does PHP compare strings using strcmp()?

    "43.4. Comparisons When comparing strings in PHP, we can use the usual comparison operators such as === , < , or <= which will compare the strings lexicographically. However, this is generally discour

Comparisons | ComputerScienceOne | Bifalgorithm | Bifalgorithm