
I don't think its trolling by giving information straight and to the point in a way that anyone can understand.
Ex-janitor. Might pop in from time to time, otherwise you can grab all my information from http://jamesy.me.uk/
Totally disagree, some times performance is far more important. The balance between performance and security is important to get right and can only ever be judged on a case by case basis.
Kinda a contradiction, Ternary operators are often harder to read that simple if's or cases. On the flipside id say && or || is actually easier to read than writing the word "/2) learn to love () ? : (ternary operator)
3) use "and" and "or" instead of && and ||, much easier to read and understand, does exactly the same thing
True, no real reason to ever use it ether4) never use $_REQUEST, very easy to forge things
Very wrong, they perform two different actions and '' is upto a factor of 4 faster... Double quotes include parsing of variables within it, single quotes just passes a string o.05) "" and '' perform the same, stop being eejits and saying one performs faster than the other, they don't any more, use either
The speed saved here would be lost totally by taking your advice above?6) use , instead of . in echo, it's faster
Print is often faster?7) use echo instead of print unless you want to hang on to the variable, it's faster
Sessions are more secure + store more data and data-types than cookies are capable of ?8) use cookies instead of sessions unless you specifically need sessions
Or use somthing that replaces strings like str_replace?9) use strstr instead of foreach / for loop for replacing things
... Whut?
No... it really wont, almost all of it was dead wrong?
Yea as dealing with huge amounts of data is a thing a company would never ever come across in the real world (much larger than a 100,000)... What planet did you say you were from?
Seeing as its mostly totally wrong, i think its probably worse than most trolling as people are actually believing it
Comic book guy: Worst php tutorial.. ever
Last edited by Mentor; 21-07-2009 at 08:58 PM.
Says you... the person who likes and loves to argue about anything and everything PHP/html/ruby/js (the list can go on).
Anyway, these tips are very helpful for the people just learning PHP... and even more advanced members.
If by learn php, you mean fail at then yes? These tips are almost all wrong, and whats not is essentially useless common sense. Anyone other than a total php noob who cant see this is seriously over estimating there php skills.. Why are people defending these tips? has no one actually read them?
Also, ad hominem really isn't helpful, hes right whether or not you like him and whether or not he likes to argue. Facts stay the same regardless of who's telling you them...
Dan, you didn't say anything about <? being faster than <?php
...
@thybag It's just his personal prefs he's posted saying they are tips rly![]()
Last edited by BoyBetterKnow; 21-07-2009 at 09:05 PM.
This "balance" you speak of is nothing but a scapegoat for coders to get out of ******* up, if you have a gigantic database and someone strolls in there and deletes everything because you made this little bit of code faster by removing a check, you're gonna be enjoying hours of work restoring backups. There is no balance, security always comes before performance, if you can't get it to perform fast enough with the security, throw more servers at it.
I never said they were easy to read, I find them to be better than simple if/else statements, personal opinion there. I said or/and is easier to read, and it is, if you get an average joe and slap them && || "and" or "or", which are they going to understand without any coding/programming experience? (hint: it's and/or)
Maybe at php 4.3 sure, but not with php 5 + 4.3 (i think it's 4.3, don't quote me on it), the performance differential is completely eliminated.
question is answered above
print is never faster as it has to return after it's done (always returns 1)
data types in php are stupid and always have been, the only reason you ever need data type storage in php is for strict comparisons, strings are fine for everything in a real-world situation
my bad, i meant strtr
attn all: i only work with real-world situations nowadays, i don't bother with benchmarks and testing scenarios, as they're utterly useless when building apps and such
now if you'll excuse me i have a can of coke to drink
visit my internet web site on the internet
http://dong.engineer/
it is just videos by bill wurtz videos you have been warned
Not going to comment on the PHP as I really don't know all that about it. I have to agree with Iszak though.. your posts are stupid and sarcastic at the best of times.
Back for a while.
That or someone working in the real world in part of an application where speed is critical and checking an inputs a waste of time as the db has no write access anyway...This "balance" you speak of is nothing but a scapegoat for coders to get out of ******* up, if you have a gigantic database and someone strolls in there and deletes everything because you made this little bit of code faster by removing a check, you're gonna be enjoying hours of work restoring backups. There is no balance, security always comes before performance, if you can't get it to perform fast enough with the security, throw more servers at it.
But i'm guessing you aint come across the real world yet. When your working with 10's or millions of records, these things count.
With no coding experience, thay ain't going to under stand the sql syntax to start with, so thats kinda a null point. If not easier to read, faster or anything else - what exactly makes them better?I never said they were easy to read, I find them to be better than simple if/else statements, personal opinion there. I said or/and is easier to read, and it is, if you get an average joe and slap them && || "and" or "or", which are they going to understand without any coding/programming experience? (hint: it's and/or)
No, with php 5 (and 4 too, and 3... well all php), and for obvious reasons? Obviously it depends on setup, but as a rule when writing fast php code, it makes the difference.Maybe at php 4.3 sure, but not with php 5 + 4.3 (i think it's 4.3, don't quote me on it), the performance differential is completely eliminated.
You loose alot more speed with that, than you gain here. The difference between "" and '' is still very real...question is answered above
Below 10,000 items its often faster, over that though echo will normally overtake in terms of speed. Setup and usage there for makes the differenceprint is never faster as it has to return after it's done (always returns 1)
That or for using Object Oriented code? you know OOP? being able to store a live object directly is a big advantage..data types in php are stupid and always have been, the only reason you ever need data type storage in php is for strict comparisons, strings are fine for everything in a real-world situation
The speed difference here is still less than the difference between "" and ''my bad, i meant strtr
I take it you've never had a real job in IT? Because your version of non-real world scenarios are things i deal with dayly o.0attn all: i only work with real-world situations nowadays, i don't bother with benchmarks and testing scenarios, as they're utterly useless when building apps and such
Want to hide these adverts? Register an account for free!