aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenry Wong <somethingweird@yahoo.com>2020-11-25 11:46:34 -0500
committerGitHub <noreply@github.com>2020-11-25 11:46:34 -0500
commit1111ecd59ce4cc4e844dcdc5b5dc90130a145239 (patch)
treec90fe587349dbdf71e8a7a726b02b2da4d783cc3
parent19352446d27a9bc6ffec1e288825c1a1f88eda22 (diff)
downloadperlweeklychallenge-club-1111ecd59ce4cc4e844dcdc5b5dc90130a145239.tar.gz
perlweeklychallenge-club-1111ecd59ce4cc4e844dcdc5b5dc90130a145239.tar.bz2
perlweeklychallenge-club-1111ecd59ce4cc4e844dcdc5b5dc90130a145239.zip
Create ch-1.php
-rw-r--r--challenge-088/henry-wong/ch-1.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/challenge-088/henry-wong/ch-1.php b/challenge-088/henry-wong/ch-1.php
new file mode 100644
index 0000000000..202052ca76
--- /dev/null
+++ b/challenge-088/henry-wong/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));