diff options
| author | Henry Wong <somethingweird@yahoo.com> | 2020-11-25 11:51:15 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-25 11:51:15 -0500 |
| commit | 33c35f58e0775528d066713cb20ce239f1a3037a (patch) | |
| tree | 5ca0d65dee495fc6b77ed01410fb2c0974f1e499 | |
| parent | 1111ecd59ce4cc4e844dcdc5b5dc90130a145239 (diff) | |
| download | perlweeklychallenge-club-33c35f58e0775528d066713cb20ce239f1a3037a.tar.gz perlweeklychallenge-club-33c35f58e0775528d066713cb20ce239f1a3037a.tar.bz2 perlweeklychallenge-club-33c35f58e0775528d066713cb20ce239f1a3037a.zip | |
Create ch-1.php
| -rw-r--r-- | challenge-088/henry-wong/php/ch-1.php | 17 |
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)); |
