How can PHP arrays be checked for null values?
To check PHP arrays for null values, you can iterate through the array using a loop and check each value for null using the `is_null()` function. If a null value is found, you can take appropriate action such as setting a default value or removing the null value from the array.
$array = [1, null, 3, null, 5];
foreach ($array as $key => $value) {
if (is_null($value)) {
// Handle null value (e.g. set a default value or remove it)
$array[$key] = "Default";
}
}
print_r($array);