Dynadot โ€” .com Transfer

Quicker PHP scripts?

SpaceshipSpaceship
Watch

PoorDoggie

Soon to be RICHdoggie!VIP Member
Impact
18
Hi. I want to find out if these are quicker, slower or if there is no difference...

Would changing this:
PHP:
$message = "<table>
                  <tr>
                    <td rowspan=\"2\"><img src=\"images/icons/error.gif\" alt=\"Six - Error!\" /></td>
                    <td><b>Error</b></td>
                  </tr>
                  <tr>
                    <td>To increase relevancy Six only shows upto the <b>1000</b>th result (you requested $start)</td>
                  </tr>
                </table>";
to this:
PHP:
$message = "<table><tr><td rowspan=\"2\"><img src=\"images/icons/error.gif\" alt=\"Six - Error!\" /></td><td><b>Error</b></td></tr><tr><td>To increase relevancy Six only shows upto the <b>1000</b>th result (you requested $start)</td></tr></table>";
be any quicker (bearing in mind that code like this appears many places in my scripts)

and would this:
PHP:
$echo .= "<td width=\"33%\" class=\"gray_small\" align=\"center\"><a href=\"image.php?qs=";
        $echo .= urlencode($_SERVER['QUERY_STRING']);
        $echo .= "&thumb=";
        $echo .= urlencode($result['ResultSet']['Result'][$anum]['Thumbnail']['Url']);
        $echo .= "&site=";
        $echo .= urlencode($result['ResultSet']['Result'][$anum]['RefererUrl']);
        $echo .= "&title=";
        $echo .= urlencode($result['ResultSet']['Result'][$anum]['Title']);
        $echo .= "&url=";
        $echo .= urlencode($result['ResultSet']['Result'][$anum]['Url']);
        $echo .= "&size=";
        $echo .= urlencode($result['ResultSet']['Result'][$anum]['FileSize']);
        $echo .= "&format=";
        $echo .= urlencode($result['ResultSet']['Result'][$anum]['FileFormat']);
        $echo .= "&h=";
        $echo .= urlencode($result['ResultSet']['Result'][$anum]['Height']);
        $echo .= "&w=";
        $echo .= urlencode($result['ResultSet']['Result'][$anum]['Width']);
        $echo .= "\"><img src=\"";
        $echo .= $result['ResultSet']['Result'][$anum]['Thumbnail']['Url'];
        $echo .= "\" /></a><br />";
be any quicker as one long $echo variable? ie:
PHP:
$echo .= "<td width=\"33%\" class=\"gray_small\" align=\"center\"><a href=\"image.php?qs=".urlencode($_SERVER['QUERY_STRING'])."&thumb="...

??? Thanks
Tom
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
Dan you missed the point of the post, Yes he showed the obvious slow functions to prove a point.

Languages such as php have many different ways of achieving the same end result and before deciding which to choose you should know which has the most processing power and execution time.

For example say you have a mailling list of which 5000 people are subscribed. To send a message to each 1 using the mail() function requires php to open a connection 5000 times (it cloese the connection after each email has been sent). This of course courses overheads server wise as well as an increase of execution time. The same thing can be achieved by making a connection to an smtp server and sending the 5000 emails with only 1 connection, this will save processing power and execution time as it does not have to open and close a connection EVERY time a new message is being sent. Regardless of this the majority of people use the mail() function as 1) they know it is going to work and 2) they have no idea of the possible server overheads caused by it.
 
0
•••
Obviously 5000 connections are worse than 1...
 
0
•••
Appraise.net
Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomainEasy โ€” Zero Commission
DomDB
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back