Re: Array Problem

From: Date: Sat, 17 Apr 2004 18:30:06 +0000
Subject: Re: Array Problem
Groups: php.general 
Request: Send a blank email to php-general+get-183734@lists.php.net to get a copy of this message
Saturday, April 17, 2004, 7:38:46 PM, Arthur Radulescu wrote: >> That's how you could do it ... >> >> $ar = array(); >> >> $len = strlen($a); >> for ($i = 0; $i < $len; ++$i) { >> $ar[] = $a{$i}; >> } > If I remember well strlen is used for checking the length of a string... It does ... I didn't look closely enough :( So .. the var has to be converted to str first ... or use a temp var converted to string ... except of course someone comes up with a better method of solving the problem at hand. ---- just for reference: the original problem (as I now understand it) was how to 'convert' a number into an array ... Friday, April 16, 2004, 11:00:49 PM, Flavio Fontana wrote: > Hi > I have i Problem i got a variable a=2351 now i need to create an array out of this variable > a[0]=1 > a[1]=3 > a[2]=5 > a[3]=1 > I have an idea to use the modulo function an do some Math but im > sure there is a nicer way of solving my prob > thx Flavio

« previous php.general (#183734) next »