Re: [PHP] Character Array

2002-07-11 Thread Philip Olson
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.

Re: [PHP] Character Array

2002-07-11 Thread Michal Dvoracek
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 111

Re: [PHP] Character Array

2002-07-11 Thread David Otton
On Thu, 11 Jul 2002 13:50:59 +0200, you wrote: >> >Is there an easy way to get an array of characters from a string? >> $str = 'string'; >> $chars = preg_split('//', $str, -1, PREG_SPLIT_NO_EMPTY); >> print_r($chars); > >A string is already an array of chars : >$toto="test"; >echo $toto[0]; // pr

Re: [PHP] Character Array

2002-07-11 Thread Jean-François GAZET
> >Is there an easy way to get an array of characters from a string? > $str = 'string'; > $chars = preg_split('//', $str, -1, PREG_SPLIT_NO_EMPTY); > print_r($chars); A string is already an array of chars : $toto="test"; echo $toto[0]; // prints t echo $toto[1]; // prints e echo $toto[2]; // prin

Re: [PHP] Character Array

2002-07-11 Thread David Otton
On Thu, 11 Jul 2002 12:08:59 +0100, you wrote: >Is there an easy way to get an array of characters from a string? $str = 'string'; $chars = preg_split('//', $str, -1, PREG_SPLIT_NO_EMPTY); print_r($chars); from http://www.php.net/manual/en/function.preg-split.php djo -- PHP General Mailing

[PHP] Character Array

2002-07-11 Thread Daniel
Is there an easy way to get an array of characters from a string? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php