On Wednesday, February 13, 2002, at 10:19 AM, brendan conroy wrote:
> Hi, thanks for reading this novice question, I'd be grateful if someone
> could email me and tell me if its possible to convert a string to an
> array whithout using the split[] or explode[] function, as these aren't
> appropriate for the task. I cant find any ino on php.net,
Technically, a string is an array. Use braces rather than brackets when
doing this:
$string = "erikprice";
print $string{0}; // prints "e"
print $string{1}; // prints "r"
print $string{2}; // prints "i"
print $string{3}; // prints "k"
print $string{4}; // prints "p"
print $string{5}; // prints "r"
print $string{6}; // prints "i"
I hope you get the picture. NB I haven't tested this code, but the
theory is right. Check the online documentation, I think under
variables -- this is kind of hidden.
If you don't mean a character-based array, you'll have to be more
specific about what you're asking -- provide an example.
Also, are you sure you mean to use brackets when you say 'split[]' and
'explode[]' ? It's supposed to be parentheses. 'split()', 'explode()'.
Erik
----
Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php