Yeah, it behaves like that. But keep in mind
that you should use {} instead of [] for strings
as [] with strings like this is deprecated.
$str = 'abc';
print $str{0}; // a
print $str{2}; // c
The manual also talks about this use too:
http://www.php.net/manual/en/language.types.string.php
Regards,
Philip Olson
On Thu, 11 Jul 2002, Michal Dvoracek wrote:
> Hello,
>
> IMHO string is array of characters
>
> so is possible:
> $str = 'string';
> for ($i = 0; $ < count($str); $i++)
> echo $str[$i];
>
> Regards,
> Michal Dvoracek [EMAIL PROTECTED]
> Capitol Internet Publisher, Korunovacni 6, 170 00 Prague 7, Czech Republic
> tel.: ++420 2 3337 1117, fax: ++420 2 3337 1112
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php