Re: Speed
| From: | John Lim | Date: | Tue, 22 May 2001 18:04:42 +0000 |
| Subject: | Re: Speed | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-7835@lists.php.net to get a copy of this message | ||
Aha, an ex-ASP programmer!
I've heard that the stop and start is faster, but it really doesn't matter
with PHP. In ASP its an issue because ASP does a context switch every time
from HTML to the VBScript/JScript compiler. PHP doesn't do any context
switches so there's no overhead to stop and start.
Echo is probably faster as it's shorter :-)
Regards, John
"Jerry Nelson" <jnelson@datanamics.com> wrote in message
news:5.0.2.1.0.20010522124748.00a57ec0@dnmcinc...
> I am fairly new to PHP and am right now writing my first complicated
> script. There is a lot of HTML in the page and I was wondering which
> method is faster. To always be inside the <?php ?> tags or to stop and
> start.
> Here is a quick example (not necessarily a good one)
> <?php
> $sql2 = "select ABBREV from STATES";
> $result2 = OCIParse($conn,$sql2);
> OCIExecute($result2) or die("It's not possible to query");
> ?>
> <select name=STATE >
> <?php
> while (OCIfetch($result2,1)) {
> ?>
> <option><?php echo OCIresult($result2,1)?>
> <?php } ?>
> </SELECT>
>
> OR
>
> <?php
> $sql2 = "select ABBREV from STATES";
> $result2 = OCIParse($conn,$sql2);
> OCIExecute($result2) or die("It's not possible to query");
> echo "<select name=STATE >";
> while (OCIfetch($result2,1)) {
> echo "<option>";
> echo OCIresult($result2,1)
> }
> echo "</SELECT>";
> ?>
>
> Also which is faster print or echo.
> Thanks
>
> *---------*-----------*----------*---------*---------*---------*--------*
> Jerry Nelson
> Systems Analyst
> Datanamics, Inc.
> 973-C Russell Ave
> Gaithersburg, MD 20879
> TEL: 301-948-3515
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net
> For additional commands, e-mail: php-windows-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>