Php null value replacement in script

Jyotishgher Astrology
By -
0

 Php null value  replacement in script

To replace all occurrences of null in an array with another value you can use the array_map() function that is built into PHP. This function applies a callback function to each item in your array and returns a new array with all the return values of that callback function.5

is_null

is_null — Finds whether a variable is null

Definition and Usage

The is_null() function checks whether a variable is NULL or not.

This function returns true (1) if the variable is NULL, otherwise it returns false/nothing.


0

I think using the is_null function would be much more useful:

$address = $data['address'];
if ( is_null($address) ) $address = 'Address is not available.';

EXAMPLE:
		$response["LAST_ISS_DT"] = $objResult["LAST_ISS_DT"];	
if ( is_null($response["LAST_ISS_DT"]) ) $response["LAST_ISS_DT"] = '';	

Post a Comment

0Comments

Post a Comment (0)