Jump to content


Photo

caterater and bouble qoutes help


  • Please log in to reply
2 replies to this topic

#1 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 11 March 2006 - 07:09 PM

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.
<?
$name = "peter";
echo "my name is ".$name;
?>

example 2

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

Are the both examples valid or not.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 11 March 2006 - 07:18 PM

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.
Legend has it that reading the manual never killed anyone.
My site

#3 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 11 March 2006 - 07:29 PM

[!--quoteo(post=353977:date=Mar 11 2006, 07:18 PM:name=AndyB)--][div class=\'quotetop\']QUOTE(AndyB @ Mar 11 2006, 07:18 PM) View Post[/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.


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




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

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

As you can see why i asked cheers.


Solved unless any advise is needed for me to understand more thank you for your support.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users