PDA

View Full Version : echo Vs. print. I recommend echo, why? ...


mindfriction
07-20-2004, 07:52 PM
Was trying to figure out which was best, since both essentially to the same thing. Managed to find a preformance test done by some other dude.

http://dynacker.dotgeek.org/printvsecho/

freddycodes
07-20-2004, 08:07 PM
Echo is a construct, print is a function.

Whats the difference, print has a return value echo does not.

The difference is so minimal, I would say use whatever you fancy.

mindfriction
07-21-2004, 09:01 AM
Yeah sort of rheotorical question in my post. Was just pointing out the peformance difference :). I can't believe how many functions/ constrcuts in PHP do the same thing. Unlike most languages where functions just get depricated it seems PHP keeps em all ! Ive been woking with PHP for just under (only) 3yrs and I swear for every function ive ever used there's several others that do the same thing! Argh!

Oh and Freedy, just a brief question about passing vars b/w flash and PHP. When using POST I'm limited to 250chars correct?

The reason I ask is that I have a slight dilemma with a registration form which has a huge amount of data that needs to be passed to the mySQL db... And just to make things worse ive also found that the LoadVars objs are limited to 64k of POST data (but im sure the form data wont ever get to be more than that).

How would you go about creating an algorithm for sending and loading such a vast amounts of data?

1 approach I've considered is breaking the form up into seperate 'pages' with button "Next Page', which on press submits the previous page's data. The only problem is, if the user quits mid-way, or and error occurs there will be incomplete records in the db :( Any ideas?

freddycodes
07-21-2004, 05:53 PM
255 characters is with GET not POST.

The first question I would ask is what in the world are you sending?

You should look into amfphp purely for permformance boost you will get from the binary format that used you transport your data.

mindfriction
07-22-2004, 04:02 AM
Hi freedy,

Its purely text im sending.

Here's a list of the fields i have in the form:

first name
last name
street
suburb
postcode
state
country
business areacode
business ph
fax areacode
fax ph
mobile phone
website
email address
username
password
secret question (for password retrieval)
secret answer

So as you can see potentially there is alot of data to send. Anyway I'll look into this AMFPHP, but it's too late in this project to probably use it :(

Thanks

freddycodes
07-22-2004, 05:43 AM
Yeah I will bet my life savings on the fact that there is not way that adds up to 64k, let's try 5k tops, more like 2 or 3

CyanBlue
07-22-2004, 01:48 PM
Fun... Still can't make 64k with these though... :D


http://www.bbc.co.uk/h2g2/guide/A418565

The World's Longest Place Name

Krungthep Mahanakhon Bovorn Ratanakosin Mahintharayutthaya Mahadilokpop Noparatratchathani Burirom Udomratchanivet Mahasathan Amornpiman Avatarnsathit Sakkathattiyavisnukarmprasit


The World's Longest Place Name

Llanfairpwllgwyngyllgogerychwyrndrobwyll-llantysiliogogogoch

mindfriction
07-22-2004, 02:04 PM
LOL, well i'll make that country an exception, I think 30 chars is enough for a country name. :)

Thanks guys

Flash Gordon
05-03-2005, 06:00 AM
Can someone reconmmend a good php tutorial? My problem is I have seen several and like posted above, some use print and some use echo. Even more so, some echo("Hello World"); echo ('Hello World'); and echo "Hello World"; I just want to learn the standard and right way. So...Anybody got a GOOD tutorial on php4 or even maybe php5?
Thanks

CyanBlue
05-03-2005, 06:04 AM
What about the PHP manual??? The user guide in that file has good amount of information/lots of code snippets and It works for me... ;)

Flash Gordon
05-03-2005, 06:06 AM
What about the PHP manual???
you mean this: http://www.php.net/manual/en/ ?

CyanBlue
05-03-2005, 04:06 PM
Yup... :)