KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have 2 * array and I want to merge them, but each of theme have some NULL rows . $a = array( 'a' => NULL, 'b' => 1, 'c' => 1 ); $b = array( 'a' => 1, 'b' => NULL, 'c' => 1 ); So, code: $c = array_merge($a,$b); Will give $c: array { 'a'=> 1 'b'=> NULL 'c'=>1 } Is there build in or simple way to do margin ($a,$b) like following, but now $a is overwritten for every same index from $b . I want $b to be overwritten by $a index if $b index is null - in example $b['b'] should be overwritten from $a All NULL rows should be filled if possible.
Tags (comma-separated)
Save Edits
Cancel