Difference between and in php

Possible Duplicate:
PHP: different quotes?

Simple question:

What is the difference between ' and " in php? When should I use either?

asked Sep 9, 2009 at 22:54

johnnietheblackjohnnietheblack

12.8k27 gold badges91 silver badges132 bronze badges

5

Basically, single-quoted strings are plain text with virtually no special case whereas double-quoted strings have variable interpolation [e.g. echo "Hello $username";] as well as escaped sequences such as "\n" [newline.]

You can learn more about strings in PHP's manual.

answered Sep 9, 2009 at 22:57

There are 3 syntax used to declare strings, in PHP and -> may look similar but are totally different in their usage. => is referred to as double arrow operator. It is an assignment operator used in associative arrays to assign values to the key-value pairs when creating arrays.

What is difference between and in PHP?

The difference is, strings between double quotes ["] are parsed for variable and escape sequence substitution. Strings in single quotes ['] aren't. The same in single quotes returns the literal string. you would probably use single quotes, to avoid having to escape the quotes in the string and vice-versa.

What is the difference between & and && in PHP?

Introduction to the PHP AND operator The && and and operators return the same result. The only difference between the && and and operators are their precedences. The and operator has higher precedence than the && operator.

Chủ Đề