diff options
| author | Henry Wong <somethingweird@yahoo.com> | 2020-11-25 11:46:34 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-25 11:46:34 -0500 |
| commit | 1111ecd59ce4cc4e844dcdc5b5dc90130a145239 (patch) | |
| tree | c90fe587349dbdf71e8a7a726b02b2da4d783cc3 | |
| parent | 19352446d27a9bc6ffec1e288825c1a1f88eda22 (diff) | |
| download | perlweeklychallenge-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.php | 17 |
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)); |
