Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 01-23-2002, 06:08 PM
Psychdrone Psychdrone is offline
 
Join Date: Nov 2001
Posts: 525
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Whats the difference be tween these two?

My book says that there the same, And I see Vb uses Echo everywhere. so ummmmmmmm whats the difference

Thanks!
Reply With Quote
  #2  
Old 01-23-2002, 06:17 PM
Mark Hensler's Avatar
Mark Hensler Mark Hensler is offline
 
Join Date: Oct 2001
Location: California
Posts: 205
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

one ASCII character

Actually, theres more to it...
echo() can take multiple arguements (when enclosinge the parameters within parentheses).
print() will return TRUE on success and FALSE on failure.

They basically are the same. Just small, almost irrelevant differences.
Reply With Quote
  #3  
Old 01-23-2002, 11:55 PM
Psychdrone Psychdrone is offline
 
Join Date: Nov 2001
Posts: 525
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ok so echo can do this

echo "somthing" "something" "something";

and print can only do this

print "something";

???????

hey also there is one more thing that I am confused about what ezactly dose the command

/n do?


Thanks a lot
Reply With Quote
  #4  
Old 01-24-2002, 01:27 AM
Snake~eyes Snake~eyes is offline
 
Join Date: Oct 2001
Posts: 191
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well form C++ i can tell you that \n is like when you hit enter or in html known as <br>
Reply With Quote
  #5  
Old 01-24-2002, 04:35 AM
Action-N's Avatar
Action-N Action-N is offline
 
Join Date: Jan 2002
Location: Pasco, WA
Posts: 225
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Okay, lets me see if I can help with this.

plain HTML lets HTML print out the text.
echo statement has php simply print out HTML code.
print statement is a function, so it uses more recourses.

This is for the most part how I have come to understand it. Many people have tested all three to see what is faster to use, and yes it's way to close to matter to most of us.

When I was first working with php I was using echo since that was all I really ever seen. Then I bought a PHP book and they used a "pro" looking print tag
PHP Code:
print(" "); 
that I started using. That is until I read that it's a function that has to process the HTML, well do I have to tell you what I'm back to using now? Right the echo tag. Straight HTML might be faster, but it looks less attractive and probably uses more characters when mixed with allot of php.
Reply With Quote
  #6  
Old 01-24-2002, 04:58 AM
Mark Hensler's Avatar
Mark Hensler Mark Hensler is offline
 
Join Date: Oct 2001
Location: California
Posts: 205
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

when sending echo() multiple arguements, use this syntax:
echo "somthing", "something", "something";

... you forgot the commas

/n does nothing, \n is a new line character
Reply With Quote
  #7  
Old 01-24-2002, 05:59 PM
Snake~eyes Snake~eyes is offline
 
Join Date: Oct 2001
Posts: 191
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

whoops.. yeah that's what i meant.. lol
Reply With Quote
  #8  
Old 01-25-2002, 01:05 AM
Psychdrone Psychdrone is offline
 
Join Date: Nov 2001
Posts: 525
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

err, I am a little confused!

All print can do, is display text right??

So echo can display text, but dosn'nt need to be retyped?

so

print "hello, world"
print "this is a second test"

vs

Echo "hello world","this is a second test"

>????????????

O and by the way, thank you guys so much for taking your time
Reply With Quote
  #9  
Old 01-25-2002, 02:24 AM
Action-N's Avatar
Action-N Action-N is offline
 
Join Date: Jan 2002
Location: Pasco, WA
Posts: 225
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So they are the same, it's all about what your preference is. Use what ever you think looks better. Both function the same, and any speed differences are not a concern for the average user.

If you want just make a empty php page and play around testing out what works with what. If you get a parse error then it wasn't right. I've seen both tags used many different ways, it's just all about what you prefer.
Reply With Quote
  #10  
Old 01-25-2002, 05:32 AM
Mark Hensler's Avatar
Mark Hensler Mark Hensler is offline
 
Join Date: Oct 2001
Location: California
Posts: 205
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The fact that echo() can take several arguements is really a mute point.... take this for example:
PHP Code:
$var "this";

// example 1
print $var " is a string";

//example 2
echo $var" is a string";

//example 3
echo $var " is a string"
All three produce the exact same thing. print() may not be able to take several arguments, but who cares... both functions work with the dot (.) concat thingy. Example 2 and 3 are exactly the same, even though 2 uses a comma and 3 uses a dot.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:48 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06449 seconds
  • Memory Usage 2,258KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete