0
Good afternoon, you guys, I know the question may seem repetitive, but I’m already a while looking for the solution to my case, especially here in #stack.
I got the following Array():
array (size=9)
'Janeiro' =>
array (size=54)
0 =>
array
'nome' => string 'Pessoa1'
'valor' => string '9'
1 =>
array
'nome' => string 'Pessoa2'
'valor' => string '2'
2 =>
array
'nome' => string 'Pessoa1'
'valor' => null
3 =>
array
'nome' => string 'Pessoa2'
'valor' => null
4 =>
array
'nome' => string 'Pessoa3'
'valor' => null
'Fevereiro' =>
array
0 =>
array
'nome' => string 'Pessoa1' (
'valor' => string '28'
1 =>
array
'nome' => string 'Pessoa2'
'valor' => string '17' (length=2)
2 =>
array
'nome' => string 'Pessoa3'
'valor' => string '2' (length=1)
3 =>
array
'nome' => string 'Pessoa1'
'valor' => null
4 =>
array
'nome' => string 'Pessoa2'
'valor' => null
5 =>
array
'nome' => string 'Pessoa3'
'valor' => null
6 =>
array
'nome' => string 'Pessoa4'
'valor' => null
... And so on containing every month these days. I’m trying to return an array that looked like this:
array
'Pessoa1' =>
array
meses => v1,v2,v3,v4,v5,v6,v7,v8,v9
array
'Pessoa2' =>
array
meses => v1,v2,v3,v4,v5,v6,v7,v8,v9
And so on catching all the "People", only as shown in exe. has month that the value of the person is null and has month that it has value, so I need to keep the values null, ex [null,null,2,3,4,5,6,null,null,]
https://answall.com/questions/53302/
– NoobSaibot
@Noobsaibot I used this example as a base but could not return as I posted in the question.
– Diogo Moura
But the same person appears more than once in certain months. How does it work in this case ? If you can build a complete example it is ideal to be easy to answer
– Isac
I don’t think it is possible otherwise, but to run a logic of loops and go through the array to find all people.... and another loop traversing again to assign in what months and their values that person appears in the array.... I think it has to be in the same race.... rsrsrs A complete example would be interesting to test and propose the solution of a more interesting algorithm... T+
– alberane
@I’ll try to explain the context. I have the month array within that array I have the person array that will contain its name and value and yes I have within the month array a list of all the people in my BD who in case would be with the value null + the people who have any data registered in the value field, then I have mes1[person=> name = person1 value = 10, name = person1 value = null] there in that case if it has the value field other than null replaces, someone had posted a Cód almost with the solution but it deleted the answer.
– Diogo Moura
Well if case is still n clear I can create a bin of the array and post here, because it is a little large.
– Diogo Moura