Re: FW: Accessing a Char in an Array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2004-12-21 at 23:47, Justin Palmer wrote:
> *Sorry Curt for sending this to you.*
> 
> Hi,
> 
> Well if any one is interested in the speed I set up an example that you
> can go to.  Though, when I run the example substr() is very neurotic (or
> it seems that it is to me). It can process the same line of code at a
> lot of different intervals, while accessing it with {} is pretty
> consistant.
> 
> What is the cause of this?
> 
> I thought it might be the server, but would that not effect it for both
> tests (two others tests with objects)?
> 
> By the by, during my testing I found that using {} to access the first
> char in a string was anywhere from .5 to 4 times faster.

{} is an operator whereas substr() is a function. Operators are
generally an order of magnitude faster than functions and if all you
want is the first character then {0} is much more efficient than
substr().

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux