php
Started on the old forum in April 2010 · view the original in the archive · old links redirect here
i didnt start it !!
Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!
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... _______…
subzero wrote: ELSE is abit faster then case or else if(user =
Faster to use is else if(user ==
i don't know why but it seems faster to load in 8 less the = or case
else will be obviously faster than else if and case because else do not need to check any condition so it wont need any machine cycle or T-state to check condition.
Follow me @ksg91 | My Blog: http://ksg91.com | Nokia Blog: http://NokiaTips.in
Yes see my point there
i did show case script here but you see what one turns faster is (ELSE)
case change abit slower then case i always used else if ($user == "") not else if ($user = '')
Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!
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... _______…
Im useing else if because of the complex database structure. It would be silly calling say 5 or 6 tables when i can simply use else or else if in a single line with the exact outcome i also used case now and some of my pages appear to freeze and display blank once on reload it works again so i agree with sub upon my tests else is faster the case
BakGat
class Counter {
public:
void Count();
int ReadDisplay();
private:
int CurrentCount;
};
External image (may be gone) External image (may be gone) External image (may be gone)
Back up my hard drive? How do I put it in reverse? http://www.hackthissite.org Profile…
subzero wrote: Yes see my point there
i did show case script here but you see what one turns faster is (ELSE)
case change abit slower then case i always used else if ($user == "") not else if ($user = '')
else if ($user = '') cannot work. it wont ckeck condition but instead it will make $user variable null. if you need to compare to varible or string you must use ==
bOrN2pwn wrote: Im useing else if because of the complex database structure. It would be silly calling say 5 or 6 tables when i can simply use else or else if in a single line with the exact outcome i also used case now and some of my pages appear to freeze and display blank once on reload it works again so i agree with sub upon my tests else is faster the case
well, if page comes blank then it has nothing to do with if its case or else if. both are logically same. it could have been cause because of some bad coding or something temporary problem of server.
Follow me @ksg91 | My Blog: http://ksg91.com | Nokia Blog: http://NokiaTips.in
thank god someone else replied, i was gonna just leave it and not try to explain why switch is better than if's in a lot of cases but since someone can see one of my points and knows what im saying i'll continue.
Switch uses something called a jump table on many of its sortable operations. Take a variable = 5 and you need to kno if that var matches $var == 1|2|3|4.... so you could write an if/else tree which would mean that every conditional statement would need evaluation before moving on to the next, thats 5 comparisons until $var == 5 is reached. With a switch, the php interpreter would simply "jump" to the case 5: as it has created a jump table. A jump table is pretty much the equivalent of a mysql temporary index. We use indexes in mysql (i hope you do anyway) to speed up conditional searching, why not apply the same theory to your php code ?
Ofcourse switch isnt downright better than an if/else tree, it cant do complex matches (well it can using switch(true) but theres no point unless you do it for readability purposes but that personal preference) and it is ever so slightly quicker than switch on a very small comparison (for e.g. if/elseif/elseif/else) but when it comes to people using if/elseifx1000/else for smiley codes {this is the biggest place ive seen it lately} its just daftness tbh, mind you a switch wouldnt be the perfect idea either for such a thing as both methods arent exactly the best)
oh and i just saw sub's post so heres your reply
- making 10 scripts means nothing, i know people that have rolled out over 30 scripts yet id never ask um to code for me and id definately never pay for there crap, so thats not a worthy point for you to make
- you want to show what case is and tell me i dont know php then show a case statement using MySQL markup not PHP, riiiiiiiight
- since it isnt a rrecent post i made i have no idea what thread your on about, i rarely provide any copy and paste code as i dont spoonfeed people too often, i also dont provide code for use on premade wap scripts, so most of what i do provide always needs to be modified to work within a ready made application, i expect anyone using what i post to have some degree of competency with php or be ready to learn on the fly. Without seeing this so called script i posted however i cant comment on a specific situation.
Oh and ofcourse if/elseif/else does the same as switch, else there wouldnt be a comparison to be made and id have never provided it as an alternative. if you were fererring to case and else being the same i think ive already explaned thats correct as they are two completely different things
@ Mars, not complete bull actually. Go open and make a successful torrent site and see how important optimisation can be on a single script that gets > 100,000 hits per hour (thats on a relatively small site too, some of the bigger ones ive seen hit over 10mil but those usually switch to C++ trackers at the 1mil mark). This thread ofcourse is pretty much bull and its just knitpicking, out of all the things that could be done, most of the stuff in here is useless to you and most others here especially while your coding for wap users. Having said that i agree you should weigh up readability and therefore convienience with the potential speed increase. But if you look around the nets at any half decent coding forum you'll find people use switches instead of large blocks of if's because its generally more readable to a larger portion of coders than those that support the block if method
riderz: forget it, done and dusted lol. I cant be bothered. you can use whatever you like as it makes little difference. You can use if blocks, switches or a ternary operator, they all produce the same end result. If your that interested in speed start looking at your mysql stuff first and means of basic caching, thats where the biggest savings are usually to be found in your code