Re: Array conversion
| From: | Ernest E Vogelsinger | Date: | Thu, 29 May 2003 23:51:36 +0000 |
| Subject: | Re: Array conversion | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-149505@lists.php.net to get a copy of this message | ||
At 01:38 30.05.2003, John Wulff said:
--------------------[snip]--------------------
>I'm new to working with complex arrays/objects and need a little help.
>Below is the array I need to convert to a different type of array. The
>"begin what i have" section is data I've succesfully mined from an XML file.
>The data labeled "desired output" is how I need the data to be formatted.
>How do I do this?
--------------------[snip]--------------------
$result = array();
while (list($key, $object) = each($whatihavelist)) {
$result[] = array($object->name,
$object->stocks,
$object->bonds,
$object->mutual,
$object->insurance,
$object->other);
}
But why would you want to skip your nicely named, easily readable objects
in favour of sequentially numbered arrays?
Just wondering...
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/