Page 1 of 1

Exploding !!!

Posted: Thu Jan 08, 2009 9:24 pm
by Weasel5-12
Just a small question.

How can I, if possible (in a simple way), expode a variable consisting of one word, whereby I wish to store the letters in in an array?

I understand that you cannot have a NULL deliminator in the explode function, hence why i pose the question here.


thankyou in advance for any and all assistance.



weasel

Re: Exploding !!!

Posted: Thu Jan 08, 2009 9:31 pm
by Cirdan
I believe you can access each character as if it were an array already.

Just tested it, and it works.

Code: Select all

 
$text = 'this is my string';
echo $text[0]; // returns t
 

Re: Exploding !!!

Posted: Thu Jan 08, 2009 10:45 pm
by Weasel5-12
thankyou very much.

very much appreciated

Re: Exploding !!!

Posted: Fri Jan 09, 2009 2:36 am
by Mark Baker
Weasel5-12 wrote:How can I, if possible (in a simple way), expode a variable consisting of one word, whereby I wish to store the letters in in an array?
You can use the str_split() function