How to convert the null values to empty string in php array?

后端 未结 9 1599
一个人的身影
一个人的身影 2020-12-16 13:31

I want to convert this array that Array[4] should not give null it can give blank space (empty string).

Array (
    [0] => 1
    [1] => 4
    [2] =>         


        
9条回答
  •  执笔经年
    2020-12-16 13:45

    This can be solved in one line using:

    array_walk($array_json_return,function(&$item){$item=strval($item);});
    

    here $array_json_return is the array.

提交回复
热议问题