vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Print?echo? (https://vborg.vbsupport.ru/showthread.php?t=34408)

Psychdrone 01-23-2002 06:08 PM

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!

Mark Hensler 01-23-2002 06:17 PM

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.

Psychdrone 01-23-2002 11:55 PM

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 ;)

Snake~eyes 01-24-2002 01:27 AM

Well form C++ i can tell you that \n is like when you hit enter or in html known as <br>

Action-N 01-24-2002 04:35 AM

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.

Mark Hensler 01-24-2002 04:58 AM

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 ;)

Snake~eyes 01-24-2002 05:59 PM

whoops.. yeah that's what i meant.. lol

Psychdrone 01-25-2002 01:05 AM

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;)

Action-N 01-25-2002 02:24 AM

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.

Mark Hensler 01-25-2002 05:32 AM

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.


All times are GMT. The time now is 06:55 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.01473 seconds
  • Memory Usage 1,732KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete