Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #16809
| From | alex <alex@nomailno.it> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | how extract key and valu from object |
| Date | 2016-07-01 10:46 +0200 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <nl5alr$g20$1@gioia.aioe.org> (permalink) |
with print_r ($opzioni_select);
I have this:
Array (
[all] => Select
[0] => stdClass Object ([option] => Array ([29] => A))
[1] => stdClass Object ([option] => Array ([28] => B ))
[2] => stdClass Object ([option] => Array ([31] => C ))
)
after with
foreach ($opzioni_select as $key)
{
print_r ($key->option); echo '<br>';
}
heve this:
Array ([29] => A)
Array ([28] => B)
Array ([31] => C)
I would like to create a new array
$newArr[ array_keys($key->option) ] = array_values($key->option);
but have this error: The first argument should be an array
how can get for every element the key and the value?
An array where I can to extract for every elements the key and the value
Back to comp.lang.php | Previous | Next — Next in thread | Find similar | Unroll thread
how extract key and valu from object alex <alex@nomailno.it> - 2016-07-01 10:46 +0200
Re: how extract key and valu from object Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-07-01 15:12 +0100
Re: how extract key and valu from object alex <alex@nomailno.it> - 2016-07-02 11:30 +0200
csiph-web