I *think* either:

<?
$str = "im the one trying to do this";
echo $str[0];
?>

OR

<?
$str = "im the one trying to do this";
echo $str{0};
?>

Works -- you'll have to experiment, but I believe the second way is correct,
and will echo the first (0th) character in the string.


If you want to get more than 1 character from a string (example, characters
2-5), then use substr() -- check out the manual.


So far, I don't think you've shown a need for the string to be converted to
to an array...


Justin



on 06/12/02 5:50 AM, Rodrigo de Oliveira Costa ([EMAIL PROTECTED])
wrote:

> Hi guys, I got a string that I need to be transformed into na array of
> characters, something like:
> 
> 
> $str      ="im the one trying to do this";
> 
> //this is the string
> 
> I'd like to get an array that I can access something like $array[0] and
> get the value " i ". And this foward. Anyone have any clues on this?
> 
> Thanks,
> Rodrigo
> 
> 

Justin French
--------------------
http://Indent.com.au
Web Development & 
Graphic Design
--------------------


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

Reply via email to