why do so many people use echo etc in there php code for lines that dont require this, surley this is just more load on the server why not just use basic html this was the server dosnt do the rendering instead the browser does it therefore reducing load on server am i right people?
SCRIPTS FOR SALE BY SUBZERO
Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
_______…
Echo statements r d least things to give performance boost wen optimizing ur php software / script. Pay attention to simple coding rules and u'll be okay. Maybe we should discuss these rules sumtime.
Also ive noticed that putting if statements before foreach helps performance.
$results = mysql_fetch_array(mysql_query($some_query));
// Bad
foreach($results as $result)
{
// loop me
}
// Good
if(count($results) > 0)
{
foreach($results as $result)
{
// Loop me
}
}
mobileGIGS wrote:
Echo statements r d least things to give performance boost wen optimizing ur php software / script. Pay attention to simple coding rules and u'll be okay. Maybe we should discuss these rules sumtime.
no i ment for a basic level here not all the members in ere are compitent in doing things as others are so therfore i kept my example simple. Theres a whole deal of factors that could be discussed and if you folk want to we can do.
but yes going back i dont see the point why
echo "sitename : $sitename"; when it would be better to do it as this
sitename : <? print($sitename) ?>
therfore only making conttact to the server when needed. the rest would just be html and not in echo " ";
theres a number of simple things you can do, most of which wont make much difference unless you run time test scripts (these are fundamentality there to expose a flaw in a design and very rarely would you ever meet the conditions in a timed test, and timed tests depend on more things that just the raw code so ideally they should be performed 100's of times for accurate results ina randomised order).
Anyhows if your that interested,
use echo not print
use fetch_assoc or fetch_row not array, this creates duplicate data in RAM
use ternary statements where applicable NOT if conditions, such as when settings up dynamics in a text string for example
use single quotes not double quotes when echoing anything that you dont need to input variables into
Only break out of PHP for worthy lengths of code, making the interpreter mess around searching for tags that are next to each other really isnt nice just to get it to skip 2 or 3 html tags
Learn to use a god damn switch, elseif's going down 100's of lines just aint good coding
SCRIPTS FOR SALE BY SUBZERO
Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
_______…
completely wrong, you have no reliable data from that page, you dont know what sample data was used and you dont know the conditions under the tests were run.
As i said before nearly everything i mentioned will have little impact on non-realtime environments and only become noticeable under extreme testing that will never equate to anything you will possibly code in your lifetime.
using a 100 elseif's for smilies e.c.t. isnt wrong as such, its just ugly and bad programming, hence why i never gave a reason for this in my other post as speed is just negligable, but if you handed your code of 100 elseif's to a good programmer they'd probably throw it back at you unless you had a good reason for using it (i.e. complex conditioning).
@sub: you should learn a bit more of php tbh. since when was case a valid substitute for else ? ofcourse else is gonna be faster because those two things perform completely different thing. else vs default would at least have been a valid challenge.
Oh and never trust online resources for speed results, a quick google of "switch vs if php" revealed a source that said switch was 25% quick than if's completely contradicting the previous posters link. Without knowing the full conditions and data set that was run on a test you can't rely on other sources (they will never give you a full spec of their test as everything you can possibly think of from hardware, running processes, messenger being open, type of php module used all has a direct impact on the resultset)
SCRIPTS FOR SALE BY SUBZERO
Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
_______…
provided some half baked statement that you've given no example, evidence or any indication whatsoever to prove you actually know what your talking about
So i would beg to differ on your php skills until your able to select two functions (or atleast parts of said function) that perform an equal function
djlee i dont need to show they are not the same but they do the same thing.
You think i dont know nothing when i have 10 scripts that is made by me.
To show what case is your a retard djlee i guesting you think you know about php all you doing it arugering with ppl...
You need to learn PHP as far you bump in my topic script short urls you given ppl errors with your little code and you say i don't know nothing ?? lol your the one need to sit down and learn php
GO
SELECT FirstName, LastName, TelephoneNumber, 'When to Contact' =
CASE
WHEN TelephoneSpecialInstructions IS NULL THEN 'Any time'
ELSE TelephoneSpecialInstructions
END
FROM Person.vAdditionalContactInfo;
You can see here case do come slower and needs to know... case is not so old as well that come in php 2.5.4
SCRIPTS FOR SALE BY SUBZERO
Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
_______…