aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-088/henry-wong/php/ch-1.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/challenge-088/henry-wong/php/ch-1.php b/challenge-088/henry-wong/php/ch-1.php
new file mode 100644
index 0000000000..202052ca76
--- /dev/null
+++ b/challenge-088/henry-wong/php/ch-1.php
@@ -0,0 +1,17 @@
+<?php
+/**
+TASK #1 › Array of Product
+**/
+
+function solution($a) {
+ $b = array();
+ for ($i = 0; $i < count($a); $i++) {
+ $c = $a;
+ unset($c[$i]);
+ $b[] = array_product($c);
+ }
+ return $b;
+}
+
+$a = array(5, 2, 1, 4, 3);
+print_r(solution($a));