summaryrefslogtreecommitdiff
path: root/ext/standard/tests/array/array_product_variation1.phpt
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2013-03-14 05:42:27 +0000
committer <>2013-04-03 16:25:08 +0000
commitc4dd7a1a684490673e25aaf4fabec5df138854c4 (patch)
tree4d57c44caae4480efff02b90b9be86f44bf25409 /ext/standard/tests/array/array_product_variation1.phpt
downloadphp2-master.tar.gz
Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2.HEADphp-5.4.13master
Diffstat (limited to 'ext/standard/tests/array/array_product_variation1.phpt')
-rw-r--r--ext/standard/tests/array/array_product_variation1.phpt58
1 files changed, 58 insertions, 0 deletions
diff --git a/ext/standard/tests/array/array_product_variation1.phpt b/ext/standard/tests/array/array_product_variation1.phpt
new file mode 100644
index 0000000..cd2ed71
--- /dev/null
+++ b/ext/standard/tests/array/array_product_variation1.phpt
@@ -0,0 +1,58 @@
+--TEST--
+Test array_product() function : variation
+--FILE--
+<?php
+/* Prototype : mixed array_product(array input)
+ * Description: Returns the product of the array entries
+ * Source code: ext/standard/array.c
+ * Alias to functions:
+ */
+
+echo "*** Testing array_product() : variation - using non numeric values ***\n";
+
+class A {
+ static function help() { echo "hello\n"; }
+}
+$fp = fopen(__FILE__, "r");
+
+$types = array("boolean (true)" => true, "boolean (false)" => false,
+ "string" => "hello", "numeric string" => "12",
+ "resource" => $fp, "object" => new A(), "null" => null,
+ "array" => array(3,2));
+
+foreach ($types as $desc => $type) {
+ echo $desc . "\n";
+ var_dump(array_product(array($type)));
+ echo "\n";
+}
+
+fclose($fp);
+?>
+===DONE===
+--EXPECTF--
+*** Testing array_product() : variation - using non numeric values ***
+boolean (true)
+int(1)
+
+boolean (false)
+int(0)
+
+string
+int(0)
+
+numeric string
+int(12)
+
+resource
+int(%d)
+
+object
+int(1)
+
+null
+int(0)
+
+array
+int(1)
+
+===DONE=== \ No newline at end of file