PHP - single and double quotes - the difference
Topics

PHP - single and double quotes - the difference

function php
There's a button below (sneak peek) to peek at the code.
Php says:

sugar

$variable

This is sent to the browser:

It is easy to see what the single quote does. Now what if you need quotes in quotes? It would look like this:

Php says:
'sugar'
or
'sugar'
or
"sugar"
or
"sugar"

But what happens if you add a variable. Let's take a look:

Php says:
'sugar and sugar'
or
'sugar and $variable'
or
"sugar and $variable"
or
"sugar and sugar"

>> continue


submit to reddit





Sneak peek of the server side code