Welcome to Dream.In.Code
Become a PHP Expert!

Join 150,011 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,449 people online right now. Registration is fast and FREE... Join Now!




Not Echoing

 
Reply to this topicStart new topic

Not Echoing

BlueFladoo
21 Nov, 2006 - 09:37 AM
Post #1

New D.I.C Head
*

Joined: 26 Aug, 2006
Posts: 47


My Contributions
Right, so I started today...
CODE
<?php
$myargite = "50";
$myauron = "0";

echo "You have $myargite Argite";
echo "You have $myauron Auron";
?>


But it doesn't echo, why?
User is offlineProfile CardPM
+Quote Post

BetaWar
RE: Not Echoing
21 Nov, 2006 - 12:43 PM
Post #2

#include <soul.h>
Group Icon

Joined: 7 Sep, 2006
Posts: 2,304



Thanked: 101 times
Dream Kudos: 1275
My Contributions
The problem is probably that the variables are being called part of the text. I don't believe that it is supposed to matter, however it makes me go through this process aswell.

Try this:
CODE
<?php
$myargite = "50";
$myauron = "0";

echo "You have " . $myargite . " Argite";
echo "You have " . $myauron . " Auron";
?>

User is online!Profile CardPM
+Quote Post

Tuzoid
RE: Not Echoing
21 Nov, 2006 - 12:46 PM
Post #3

D.I.C Head
Group Icon

Joined: 20 Aug, 2006
Posts: 120



Thanked: 2 times
Dream Kudos: 50
My Contributions
Also, why put quotes around a numerical variable?
User is offlineProfile CardPM
+Quote Post

snoj
RE: Not Echoing
21 Nov, 2006 - 01:21 PM
Post #4

Fell off the face of the earth
Group Icon

Joined: 31 Mar, 2003
Posts: 3,325



Thanked: 9 times
Dream Kudos: 750
My Contributions
QUOTE(BetaWar @ 21 Nov, 2006 - 02:43 PM) *

CODE
<?php
$myargite = "50";
$myauron = "0";

echo "You have " . $myargite . " Argite";
echo "You have " . $myauron . " Auron";
?>

You only need to do strings that way when single quotes are used. With double quotes you can either use what betawar was doing or my personal preference, surround the variable with curly brakets {$myVariable} since it makes it way easier to read, debug, and has less troubles.

User is offlineProfile CardPM
+Quote Post

BlueFladoo
RE: Not Echoing
22 Nov, 2006 - 05:09 AM
Post #5

New D.I.C Head
*

Joined: 26 Aug, 2006
Posts: 47


My Contributions
Ok, thanks.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 08:57PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month