Powered By Blogger

Friday, 7 January 2011

String concatenation


To concatenate 2 or more word or sentences   in PHP we use the dot (.) operatorThis may help us when we need to form a string using values from different fields.
Example
string3= string1. String2

Difference between double and single quotes while being used with echo & heredoc syntax
While you are using double quotes with echo with a variable in between the quotes then the output will be the value of that variable.
But if you use the single quotes instead of double quotes then only the field (variable in between the quotes will be displayed not the value)

heredoc syntax:
echo<<<begin
line1
line2
line3
begin

 It keeps the order of lines and their positions unaltered.

No comments:

Post a Comment