1--TEST-- 2Test get_defined_constants() function : basic functionality 3--FILE-- 4<?php 5/* Prototype : array get_defined_constants ([ bool $categorize ] ) 6 * Description: Returns an associative array with the names of all the constants and their values 7 * Source code: Zend/zend_builtin_functions.c 8 */ 9 10echo "*** Testing get_defined_constants() : basic functionality ***\n"; 11 12var_dump(gettype(get_defined_constants(true))); 13var_dump(gettype(get_defined_constants())); 14 15$arr1 = get_defined_constants(false); 16$arr2 = get_defined_constants(); 17var_dump(array_diff($arr1, $arr2)); 18 19$n1 = count(get_defined_constants()); 20define("USER_CONSTANT", "test"); 21$arr2 = get_defined_constants(); 22$n2 = count($arr2); 23 24if ($n2 == $n1 + 1 && array_key_exists("USER_CONSTANT", $arr2)) { 25 echo "TEST PASSED\n"; 26} else { 27 echo "TEST FAILED\n"; 28} 29 30?> 31===DONE=== 32--EXPECT-- 33*** Testing get_defined_constants() : basic functionality *** 34string(5) "array" 35string(5) "array" 36array(0) { 37} 38TEST PASSED 39===DONE=== 40