lets say from zero to more is important level of the value
# very imporant
0 =>
array
'index' => string 'helloworld:Index' (length=16)
404 => string 'helloworld:Missinga' (length=19)
503 => string 'helloworld:Offline' (length=18)
'nojs' => string 'helloworld:Nojs' (length=15)
'blog' => string 'helloworld:blog' (length=15)
# important
1 =>
array
'index' => string 'helloworld:Index' (length=16)
404 => string 'helloworld:Missingb' (length=19)
503 => string 'helloworld:Offline' (length=18)
'nojs' => string 'helloworld:Nojs' (length=15)
'blogb' => string 'helloworld:blog' (length=15)
# not that important
2 =>
array
'index' => string 'helloworld:Index' (length=16)
404 => string 'helloworld:Missingc' (length=19)
503 => string 'helloworld:Offline' (length=18)
'nojs' => string 'helloworld:Nojs' (length=15)
'more' => string 'helloworld:Nojs' (length=15)
# so on
join them into one array to something like this
array
'index' => string 'helloworld:Index' (length=16) # from 0 ( others same key )
404 => string 'helloworld:Missinga' (length=19) # from 0 ( others same key )
503 => string 'helloworld:Offline' (length=18) # from 0 ( others same key )
'nojs' => string 'helloworld:Nojs' (length=15) # from 0 ( others same key )
'blog' => string 'helloworld:blog' (length=15) # from 0 ( new )
'blogb' => string 'helloworld:blog' (length=15) # from 1 ( new )
'more' => string 'helloworld:Nojs' (length=15) # from 2 ( new )
- when the key is different = append
- when the key is same = check important level get one highest level
question what is the best way we can merge multiple into array but something like this?
thanks for looking in
Adam Ramadhan
You can do this
Unlike
array_merge(), the one with the most importance goes first, and numeric keys are respected.If, like in your question, you are merging array elements in the same array, you can do