![]() ![]() So the isset($var11) and isset($var21) will return the value TRUE. The values can either be a string value or integer value or any other etc. The Variables “$var11” and “var21” are created with the values “test1” and “another test2”. checking the var21 using isset():::" Įcho " The Variables which are after the unset:: " Įxplanation: In the above example, isset() and unset() functions are used in the PHP programming language. checking the var11 using isset():::" Įcho "=> 2. You can add as many variables as needed inside isset() function to check whether they are declared/set or undeclared/unset/NULL. It will print “Here All or Any variables are now Unset”. Here isset ($a1,$b1,$c1) inside of the IF condition returns the FALSE value because the variable “$c1” value is declared as the value “NULL” so the ELSE condition’s statements will be printed. Here multiple variables are checked whether all the values to the variable’s are assigned or not. Example #3Įxplanation: In the above example, variable’s “$a1”, “$b1”, “$c1” variables are created with the values “51”, “61” and “NULL”. It will print “The variable ‘c’ is now unset”. ![]() So the IF condition’s value becomes FALSE and bypasses the IF condition and goes to the ELSE condition and prints the statements which are in the ELSE condition. Now the isset($c) is placed inside the IF condition but the variable “$c” is not assigned with any value so the value of the “$c” is considered as NULL/FALSE value. It meanse If(FALSE) will print the statements which are inside the ELSE condition which is “The Variable ‘b’ is now unset” because IF condition is FALSE and gone to the ELSE condition. So the “isset($b)” will return the “FALSE” value. Then variable “b” is created by assigning the NULL value. If the IF condition returns FALSE value then the ELSE condition’s statements will be printed. It will print “The variable ‘a’ is now set”. If the IF condition of TRUE value then the statements inside the IF condition will be printed. ![]() It means the value is set for the variable a. Example #2Įxplanation: In the above example, a new variable “a” is created using with the value “10”. If the isset() function will return/print the value “FALSE” if the isset() returns FALSE value. Then an isset() function inside the IF condition is made to return the value TRUE or FALSE but here the variable “a” is defined so the output is obviously “TRUE”. Examples to implement isset() Function in PHPĮxplanation: In the above isset() program, a variable ‘a” is declared and also defined with the value “10”. From the PHP 5.4.0 version, non-numeric offsets of strings will return FALSE value/values. Isset() function also works by accepting the multiple variables/many variables etc. ![]() The variable of the isset() function can be unset using the unset() function. If the PHP isset() function are passed with the multiple variables then isset() will TRUE only if all the variables are set. The return type of the isset() function of PHP programming language is Boolean. The isset() function works from the PHP version 4.0. The isset() function works by returning the value TRUE if the $variable exists in the isset() function (isset() programming code) which has the value which is other than NULL value. : It is an optional value/values or variable/variables to check $variable: A variable is required which is specified to check. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |