Jump to content

caterater and bouble qoutes help


redarrow

Recommended Posts

Please exsplain to me what is the diffence of useing these two examples one looks odd to me but are fully working examples.

example 1
$name assign to peter and then to join the string together i use a caterater, to echo the data i use two bouble qoutes then a caterater and a semi colon.

It looks relly wrong to me but does what it suppose to, Why does it work, Also see the secound example easer to understand but being shown in my course the example here.
[code]
<?
$name = "peter";
echo "my name is ".$name;
?>
[/code]

example 2

This example works fine and looks correct to me, But is it as i am being shown the above to learn.
[code]
$name = "peter";
echo "my name is ".$name." ";
[/code]

Are the both examples valid or not.
Link to comment
Share on other sites

[!--quoteo(post=353977:date=Mar 11 2006, 07:18 PM:name=AndyB)--][div class=\'quotetop\']QUOTE(AndyB @ Mar 11 2006, 07:18 PM) [snapback]353977[/snapback][/div][div class=\'quotemain\'][!--quotec--]
concatenator :)

As you noted, either works, but in the second example the extra blank space added to the end of what's to be echo'd is pointless.
[/quote]


Thank you andy for your support


I will use this method for echoing out one varable then in a string cheers.

[code]

<?
$name = "peter";
echo "my name is ".$name;
?>

[/code]



But if i was to echo out two varables i would have to use this example thats why i asked cheers

[code]
<?
$name = "peter";
$age = 31;
echo "my name is ".$name." and my age is ".$age." years old";
?>
[/code]

As you can see why i asked cheers.


Solved unless any advise is needed for me to understand more thank you for your support.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.