php

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

    php

    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?
    Want something coded email me at sales@webnwaphost.com for a prices.





    #2
    Yes. but you lessin the echo then it will be ok
    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


      #3
      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.

      Comment


        #4
        You mean like this?
        PHP Code:
        <?php
        echo "<html><body>";
        some php here
        echo "</body></html>";
        ?>
        Optimized:
        PHP Code:
        <html><body>
        <?php some php here ?>
        </body></html>
        My Blog: http://jhommark.blogspot.com
        My Facebook: http://www.facebook.com/jhommark
        My Official Site: http://www.undergroundweb.tk
        My Community Site: http://undergroundwap.xtreemhost.com

        Comment


          #5
          She said: <?echo $she;?> !<br/>
          <? if ($answer == "yes") { $he = "me too"; } else { $he = "oh sh!t"; } ?> He answered: <?echo $he;?>!<br/>
          Why all this? Server will say: Please, why me?
          mysterio.al - programming is a functional art

          Comment


            #6
            @mysterio now thats horrible coding!
            PHP Code:
            She Said: <?php echo $she ?>!<br/>
            He Answered: <?php echo ($answer == 'yes') ? 'Me too' 'Oh Sh!t'?>
            you c wot i mean? Little ugly coding here n there = performance drop aka server load.

            Comment


              #7
              Also ive noticed that putting if statements before foreach helps performance.
              PHP Code:
              $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
               
              }

              Comment


                #8
                Originally posted by mobileGIGS View Post
                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 " ";
                Want something coded email me at sales@webnwaphost.com for a prices.




                Comment


                  #9
                  you right mobileGIGS, i wrote it horrible to tell that not all time mixing php and html is good.
                  mysterio.al - programming is a functional art

                  Comment


                    #10
                    some time mixing php and html can decrease readibility when you wanna debug..
                    note that i said "some time"
                    Follow me @ksg91 | My Blog: http://ksg91.com | Nokia Blog: http://NokiaTips.in

                    Comment


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

                      echo 'welcome '.(isset($user) ? $user['name'] : 'Guest').', please enjoy your stay';

                      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

                      Comment


                        #12
                        Thank you DJLee
                        mysterio.al - programming is a functional art

                        Comment


                          #13
                          But i like else if {wara wara} else {wara some more} is that so wrong to do.
                          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


                            #14
                            using switch case and else if wont make difference at all

                            check this http://www.php.lt/benchmark/phpbench.php
                            Follow me @ksg91 | My Blog: http://ksg91.com | Nokia Blog: http://NokiaTips.in

                            Comment


                              #15
                              So I can use 100's of switches and else if and it will have no impact on the speed.
                              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

                              Working...
                              X