Types of PHP Strings

Learn about different types of PHP strings with the help of examples.

We have covered a lot of ground so far but have not taken much time to look at how we can create strings in PHP. PHP provides four different ways to define strings:

  • Single-quoted strings
  • Double-quoted strings
  • Heredoc strings
  • Nowdoc strings

Single quoted strings

One of the most common string syntaxes we find is the single-quote syntax. Using this syntax, we wrap the contents of our string with single quotes:

Get hands-on with 1200+ tech skills courses.