Deva Point

deva point

Our Latest Programming Tutorial

Easy To Learning

PHP is set() Function

PHP isset () is used to determine whether a variable has set or not. In other words, the PHP isset() function checks whether a variable set with unset() function. If it isn’t NULL, it won’t be set. If the testing variable has a NULL value, it returns false.

Syntax of PHP is set()

bool Iset ( $var, mixed)

Parameters: This function can accept more than one parameter. $var is the first parameter. This parameter stores the variable’s value.

Note: This function returns true only if all variables have been set.

PHP Changelog: PHP5.4: Strings now return FALSE if they are not numeric offsets

Tip 1: You can unset a variable with the unset() function.

Tip 2: PHP will retrieve the field from your class as it is stored if you don’t have methods defined.

Tip 3:  PHP Function can be overridden to create classes that are able to hold data as an array but can also be used like objects.

Example: PHP Program Use isset() function

$num = ‘0’;

{if( isset( $num ) ) If( isset ($num ))

Print_r(” $num) is used with the isset function

“;

|}

$array = array()

echo isset($array[‘deva’]) ?

“array is set.” : ‘array not set. ‘;

?>

Output:

With the isset function, 0 is set

array not set.

Published
Categorized as PHP

Leave a comment

Your email address will not be published. Required fields are marked *