PHP Logical & Programming Interview questions

PHP Logical & Programming

Here is the list of top 10 PHP Programs Asked to write you in your next PHP Interviews for 1 year Php Experience or PHP Fresher.

Download PHP Logical & Programming PDF

PHP Logical & Programming

When we are outputting our results into JSON for purpose of web services then It is a good practice to convert all null value to an empty string, below is simple PHP function to convert all null values to blank.


function convertNullToBlank($array){

foreach ($array as $key => $value) {
if (is_null($value)) {
$array[$key] = "";
}
}
return $array;

}

Above function takes an array as an argument and converts it all null values to blank.