1--TEST-- 2Test isset() function : basic functionality 3--FILE-- 4<?php 5/* Prototype : bool isset ( mixed $var [, mixed $var [, $... ]] ) 6 * Description: Determine if a variable is set and is not NULL 7 */ 8 9class foo {} 10 11echo "*** Testing isset() : basic functionality ***\n"; 12 13$i = 10; 14$f = 10.5; 15$s = "Hello"; 16$a = array(1,2,3,4,5); 17$b = true; 18$n = NULL; 19$obj = new foo; 20$res = fopen(__FILE__, "r"); 21 22echo "Integer test: " . (isset($i) ? "YES": "NO") . "\n"; 23echo "Float test: " . (isset($f) ? "YES": "NO") . "\n"; 24echo "String test: " . (isset($s) ? "YES": "NO") . "\n"; 25echo "Array test: " . (isset($a) ? "YES": "NO") . "\n"; 26echo "Boolean test: " . (isset($b) ? "YES": "NO") . "\n"; 27echo "Null test: " . (isset($n) ? "YES": "NO") . "\n"; 28echo "Object test: " . (isset($obj) ? "YES": "NO") . "\n"; 29echo "Resource test: " . (isset($res) ? "YES": "NO") . "\n"; 30 31echo "\n\nUnset the variables\n\n"; 32unset($i, $f, $s, $a, $b, $n, $obj, $res); 33 34echo "Integer test: " . (isset($i) ? "YES": "NO") . "\n"; 35echo "Float test: " . (isset($f) ? "YES": "NO") . "\n"; 36echo "String test: " . (isset($s) ? "YES": "NO") . "\n"; 37echo "Array test: " . (isset($a) ? "YES": "NO") . "\n"; 38echo "Boolean test: " . (isset($b) ? "YES": "NO") . "\n"; 39echo "Null test: " . (isset($n) ? "YES": "NO") . "\n"; 40echo "Object test: " . (isset($obj) ? "YES": "NO") . "\n"; 41echo "Resource test: " . (isset($res) ? "YES": "NO") . "\n"; 42?> 43===DONE=== 44--EXPECT-- 45*** Testing isset() : basic functionality *** 46Integer test: YES 47Float test: YES 48String test: YES 49Array test: YES 50Boolean test: YES 51Null test: NO 52Object test: YES 53Resource test: YES 54 55 56Unset the variables 57 58Integer test: NO 59Float test: NO 60String test: NO 61Array test: NO 62Boolean test: NO 63Null test: NO 64Object test: NO 65Resource test: NO 66===DONE=== 67