If $string is a string, like :

   $string = '312'; 

Then one can do :

   $string[0]; // 3
   $string[1]; // 1
   $string[2]; // 2

Note, '312' is a string and will work using above but if we define 312 as 
an integer like :

   $string = 312;

Then $string[0] will not "work" and it'll need to be juggled as a string
first, see :

   http://www.php.net/manual/en/language.types.type-juggling.php

Also, if you want to create an array and not do the above then check
out the following, an example exists to do this :

   http://www.php.net/manual/en/function.preg-split.php



Regards

Philip Olson
http://www.cornado.com/

On Fri, 23 Feb 2001, Brandon Orther wrote:

> Hello,
> 
> I have a string of 1034 and I want to have an array that has each number in
> an element.(ex: num[0] = 1, num[1] = 0, num[2] = 3 num[3] = 4) Is there a
> way to explode a string by each character?
> 
> Thank you,
> 
> --------------------------------------------
> Brandon Orther
> WebIntellects Design/Development Manager
> [EMAIL PROTECTED]
> 800-994-6364
> www.webintellects.com
> --------------------------------------------
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to