Re: Re: Array... Parent IDs

From: Date: Tue, 08 Apr 2003 17:46:13 +0000
Subject: Re: Re: Array... Parent IDs
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-142929@lists.php.net to get a copy of this message
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 $_tmpArray = Array(Array("pid1"=>1), Array("pid2"=>3)); foreach($_tmpArray as $x) foreach(array_keys($x) as $y) ${$y}[] = $x[$y]; print_r($pid1); print_r($pid2); would output something like this: Array ( [0] => 1 ) Array ( [0] => 3 ) On Tuesday 08 April 2003 10:28 am, Michael Smith wrote: > That sort of helps... I still need a way to get them into seperate > arrays, not one huge one. Is there a way to group them, like split an > array every third entry? > > -Michael > > On Tue, 2003-04-08 at 09:03, Burhan Khalid wrote: > > On Tue, 2003-04-08 at 11:51, Michael Smith wrote: > > > > This is untested, but it should do what you want : > > > > > > > > > > > > while(list($key,$val) = each ($_tmpArray)) > > > > { > > > > if (is_array($val)) > > > > { > > > > while (list($k,$v) = each ($val)) > > > > { > > > > > > > > if ($k == "product_id" && > > > > !is_array(${"pid_$v"}) > > > > ah crap -- forgot a ) should be })) > > > > > I get an error here: parse error, unexpected '{'? PLEASE HELP! -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE+kwsE/rncFku1MdIRAiFRAJ9RtWVHXsynAHWyjc5RYzHUk0Q23QCgpX8O JoKXsY6fmu8ZntZuahQMR1M= =oo6O -----END PGP SIGNATURE-----

« previous php.general (#142929) next »