|
-
Jan 24th, 2007, 11:10 PM
#1
Thread Starter
Junior Member
I dont now anything about php
but after looking at a lot of code while im bored i notice
print and echo
It looks like they do the same thing?
Im just wondering why print gets used sometimes and echo the other times?
I think im going to start to learn php
It looks like it could be fun
Last edited by Jazza; Jan 24th, 2007 at 11:14 PM.
-
Jan 24th, 2007, 11:34 PM
#2
Re: I dont now anything about php
print is lame, echo is cool.
For a more detailed explanation of similiar usefulness:
http://www.faqts.com/knowledge_base/...l/aid/1/fid/40
-
Jan 25th, 2007, 04:06 PM
#3
Re: I dont now anything about php
Some people say that using 'Print' works better, but 'echo' does the same exact thing. I Use 'echo' more then 'print'.
My usual boring signature: Something
-
Jan 25th, 2007, 06:27 PM
#4
Hyperactive Member
Re: I dont now anything about php
-
Jan 30th, 2007, 12:19 PM
#5
Junior Member
Re: I dont now anything about php
Echo is the thing that i learned first so i say 4/0 for echo!!
echo is actually a statement that shows html code so
if you do
Code:
echo "*BURP*<br><BR>html isnt so cool as echo and you know it!!"
then you get
*BURP*
html isnt so cool as echo and you know it
it is handy because you can apply variables to it such as
Code:
$name = "freakybleep"
echo ("you are a freak $name and you know it")
then you get
you are a freak freakybleep and you know it
understand?
-
Jan 30th, 2007, 05:27 PM
#6
Re: I dont now anything about php
 Originally Posted by roelor
Echo is the thing that i learned first so i say 4/0 for echo!!
echo is actually a statement that shows html code so
if you do
Code:
echo "*BURP*<br><BR>html isnt so cool as echo and you know it!!"
then you get
*BURP*
html isnt so cool as echo and you know it
it is handy because you can apply variables to it such as
Code:
$name = "freakybleep"
echo ("you are a freak $name and you know it")
then you get
you are a freak freakybleep and you know it
understand?
Variables can be embedded in any double quoted string and it is generally not a good idea to spit out HTML using echo.
-
Jan 30th, 2007, 08:08 PM
#7
Re: I dont now anything about php
 Originally Posted by visualAd
Variables can be embedded in any double quoted string and it is generally not a good idea to spit out HTML using echo.
yeah. You should close your PHP then open it again...
PHP Code:
...
while ($array = mysql_fetch_array($query)) {
?>
HTML CODE HERE
MORE HERE
LETS PUT SOME MORE HERE...
<?PHP
}
...
My usual boring signature: Something
-
Feb 1st, 2007, 11:33 AM
#8
Junior Member
Re: I dont now anything about php
yeah u guys are right but for a short sentance like the one i wrote is the echo string MUCH better els you get this
PHP Code:
hello <? echo $name; ?> how are you last time you visited was on <? echo $date; ?>
wouldnt you get sick of that method perticulary when you have more php then html
-
Feb 1st, 2007, 11:54 AM
#9
Re: I dont now anything about php
That's the way you should do it. If you have more PHP than HTML you are doing something wrong.
All your processing should be at the top of the script before you output any HTML. The HTML should then appear at the bottom and should contain only simple display logic. It should be in such a format that all the HTML could be removed and placed in a separate file to be included.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|