samedi 13 juillet 2019

printing zero in case of null in foreach loop

A php code is shown here

foreach ($icx_json_date as $key_date => $icx_value_date) {

        echo $icx_value_date["isd_out_traffic"] . ", ";
    }

the output for this code is

, , , , , , 14449.25, 881.50,

I want to replace the null output with zero and show the output as

0, 0, 0, 0, 0, 0, 14449.25, 881.50,

what changes should be done to do so?

Aucun commentaire:

Enregistrer un commentaire