Skip to content
Advertisement

PHP foreach change two-dimensional original array values

I need to replace null value to 0 and change original arrays to output. My code are not work… Only change the second foreach loop value. how to do it? I need the output array is… (My null value is not fixed in key) thank you very much… my array:

JavaScript

Below is my code:

JavaScript

Advertisement

Answer

You can use & which passes variable reference in the foreach loop. You can try the below codes.

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement