0
I have a array
multiples objects:
array(3) {
[0]=>
object(stdClass)#5750 (2) {
["value"]=>
string(16) "[email protected]"
["key"]=>
string(18) "email_client"
}
[1]=>
object(stdClass)#5254 (2) {
["value"]=>
string(20) "gold"
["key"]=>
string(19) "package"
}
[2]=>
object(stdClass)#6074 (2) {
["value"]=>
string(5) "senh4"
["key"]=>
string(18) "password"
}
}
And I need you to stay:
array = {
email_client => [email protected],
package => gold,
password => senha
}
I tried with foreach
but it does not access the objects. With the array_walk_recursive
the answer is the same. someone can help me?
You want to convert Object Array to Indexed Array, with keys?
– novic
But what I could realize that your question is an object in a way, and an example of output that does not match, the title is one thing and the question speaks in another, could be clearer about the question. and portray your reality, so that you have answers to your reality.
– novic
I have several objects within an array and each object has an 'Indice'. array{ [0] => object { key : value, value: value} }
– Ivan Moreira
place this array of objects in your question and the result you want, please?
– novic
Object(stdClass)#5750 (2) { ["value"]=> string(16) "[email protected]" ["key"]=> string(18) "email_client" } . This is the object. As you can see in the example it has an input in the array.
– Ivan Moreira
Right @Ivanmoreira, but, the result in your question does not match the keys and join the object array to a single associative array without changing the keys does not give? got it?
– novic
No? I just want ["key"] => email_client and ["value"] => mail@example of the object to be key/value of my example array email_client => mail@example
– Ivan Moreira