On Wed, 10 Nov 2004 15:56:28 -0000, Ford, Mike <[EMAIL PROTECTED]> wrote:

On 10 November 2004 13:37, Horst JÃger wrote:

(Please keep this on list -- others may be able to help better/faster than
me!)




I am thinking about complexity. How is a string implemented in PHP? A deque<char> or a char* ?

char * in a zval (and you really shouldn't use deque<char>, given the existance of string)


How does $s{n} acces the n-th char?

1. Does it go to the beginning of the string and then jump
from one char to
the next, counting the instances and return when the n-th ionstance
is reached?

2. Or does it jump to the n-th char directly?


I haven't benchmarked it, but I would assume strings derefing is signficantly faster than arrays, as arrays in php are actually hashtables, while $a{5} is just a straight deref.


--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/

http://www.smempire.org

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



Reply via email to