I am really very confused about what is used to represent a string in PHP.
If we use double inverted commas, it too represents string and same if use single inverted commas so "avinash" or ‘avinash’.
Which is a string?
Can you tell me about a good book to read PHP5 from?
Double quotes (
") and single quotes (') both represent strings. However, PHP doesn’t treat them the same way.In double quoted (
") strings, escape sequences and variable names are expanded. In single quotes (') strings, they are not. The string is not expanded.So, given the following:
The following code…
… will output this:
However, the following…
… will output this:
For more information, you can read the following documentation page on strings.