aboutsummaryrefslogtreecommitdiff
path: root/challenge-267/2colours/php/ch-1.php
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-267/2colours/php/ch-1.php')
-rw-r--r--challenge-267/2colours/php/ch-1.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/challenge-267/2colours/php/ch-1.php b/challenge-267/2colours/php/ch-1.php
new file mode 100644
index 0000000000..8b6b877a8a
--- /dev/null
+++ b/challenge-267/2colours/php/ch-1.php
@@ -0,0 +1,8 @@
+<?php
+
+function sign_of_product(array $ints)
+{
+ return array_reduce($ints, fn($acc, $current) => $acc * gmp_sign($current), 1);
+}
+
+echo 'The sign of the product is ' . sign_of_product(array_slice($argv, 1));