Possible Duplicate:
PHP: different quotes?
Simple question:
What is the difference between ' and " in php? When should I use either?
They are for different function types. -> is always used on an object for static and non-static methods (though I don't think it's good practice use -> for static methods). :: is only used for static methods and can be used on objects (as of PHP 5.3) and more importantly classes.
Conclusion. The two operators, => 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.
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.
They are both used to output data to the screen. The differences are small: echo has no return value while print has a return value of 1 so it can be used in expressions. echo can take multiple parameters (although such usage is rare) while print can take one argument. echo is marginally faster than print .
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With