Return to array_product_variation1.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / array |
1.1 misho 1: --TEST-- 2: Test array_product() function : variation 3: --FILE-- 4: <?php 5: /* Prototype : mixed array_product(array input) 6: * Description: Returns the product of the array entries 7: * Source code: ext/standard/array.c 8: * Alias to functions: 9: */ 10: 11: echo "*** Testing array_product() : variation - using non numeric values ***\n"; 12: 13: class A { 14: static function help() { echo "hello\n"; } 15: } 16: $fp = fopen(__FILE__, "r"); 17: 18: $types = array("boolean (true)" => true, "boolean (false)" => false, 19: "string" => "hello", "numeric string" => "12", 20: "resource" => $fp, "object" => new A(), "null" => null, 21: "array" => array(3,2)); 22: 23: foreach ($types as $desc => $type) { 24: echo $desc . "\n"; 25: var_dump(array_product(array($type))); 26: echo "\n"; 27: } 28: 29: fclose($fp); 30: ?> 31: ===DONE=== 32: --EXPECTF-- 33: *** Testing array_product() : variation - using non numeric values *** 34: boolean (true) 35: int(1) 36: 37: boolean (false) 38: int(0) 39: 40: string 41: int(0) 42: 43: numeric string 44: int(12) 45: 46: resource 47: int(%d) 48: 49: object 50: int(1) 51: 52: null 53: int(0) 54: 55: array 56: int(1) 57: 58: ===DONE===