O'Reilly logo

PHP for Teens by Maneesh Sethi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Making Strings

There are a few methods of creating a string, and these methods are known as different methods of syntax:

  • Single quoted

  • Double quoted

  • Heredoc

If you want to display a variable, you use the $ symbol. If you want to display a string, you use quotation marks. However, there are two forms of quotation marks: single and double. Both do different things, so let’s go over one at a time.

Note

I skip heredoc syntax because it is rather difficult to use. If you are interested in it, go to www.php.net or www.maneeshsethi.com.

Single-Quoted Syntax

Single quotation marks look like one apostrophe that appears before the string and another at the end. For example, your string might look like this:

'Hello, I am a string!'

As you can see, these ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required