php array_merge without erasing values?

前端 未结 6 1059
南旧
南旧 2020-12-16 15:23

Background: Trevor is working with a PHP implementation of a standard algorithm: take a main set of default name-value pairs, and update those name-value pa

6条回答
  •  长情又很酷
    2020-12-16 15:53

    If you also want to keep the values that are blank in both arrays:

    array_filter($foo) + array_filter($bar) + $foo + $bar
    

提交回复
热议问题