php

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    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
    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...
    _______
    Info & Tips
    php.net
    w3schools.com

    Comment


      #17
      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)

      Comment


        #18
        i know php alot ... and else is faster also much more error free ;)
        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...
        _______
        Info & Tips
        php.net
        w3schools.com

        Comment


          #19
          so you've

          1. compared two completely different functions
          2. 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

          Comment


            #20
            djlee i dont need to show they are not the same but they do the same thing.

            1. You think i dont know nothing when i have 10 scripts that is made by me.
            2. To show what case is your a retard djlee i guesting you think you know about php all you doing it arugering with ppl...
            3. 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
            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...
            _______
            Info & Tips
            php.net
            w3schools.com

            Comment


              #21
              here we go again.. another arguement in yet another thread ffs

              Comment


                #22
                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...
                _______
                Info & Tips
                php.net
                w3schools.com

                Comment


                  #23
                  Originally posted by subzero View Post
                  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

                  Comment


                    #24
                    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...
                    _______
                    Info & Tips
                    php.net
                    w3schools.com

                    Comment


                      #25
                      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
                      Code:
                      class Counter {
                      public:
                        void Count();
                        int  ReadDisplay();
                      private:
                        int  CurrentCount;
                      };








                      Back up my hard drive? How do I put it in reverse?
                      My Community
                      BakGat
                      sigpic

                      Comment


                        #26
                        Originally posted by subzero View Post
                        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 ==

                        Originally posted by bOrN2pwn View Post
                        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

                        Comment


                          #27
                          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

                          1. 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
                          2. 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
                          3. 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

                          Comment


                            #28
                            bull****. You have to write so as to be convenient for you and not for the server

                            Comment


                              #29
                              well what else can be used instead of else i dnt know php well enought

                              i see on wapdesire v2 they mostly used "main" if im not mistaken
                              ________________
                              Jacques
                              jacques@gw-designs.co.za
                              http://coding.biz.tm
                              Come join and lets make it a place to learn all the noobies how to code
                              __________________

                              NEVER FORGET TO CLICK THE TANX BUTTON IF U LIKE WHAT IM SHARING OR HELPING WITH

                              Comment


                                #30
                                @ 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

                                Comment

                                Working...
                                X