aboutsummaryrefslogtreecommitdiff
path: root/challenge-109/brtastic/php/ch-1.php
diff options
context:
space:
mode:
authorbrtastic <brtastic.dev@gmail.com>2021-04-25 01:06:54 +0200
committerbrtastic <brtastic.dev@gmail.com>2021-04-25 01:06:54 +0200
commit1fe3699c0ef3f40a145bb666cbff64a59d3aaba6 (patch)
treec214cb300d11bcc6280cafa6b6c93f26f12104e2 /challenge-109/brtastic/php/ch-1.php
parent979274b0b9897a031817d6323f6e177840d475c8 (diff)
downloadperlweeklychallenge-club-1fe3699c0ef3f40a145bb666cbff64a59d3aaba6.tar.gz
perlweeklychallenge-club-1fe3699c0ef3f40a145bb666cbff64a59d3aaba6.tar.bz2
perlweeklychallenge-club-1fe3699c0ef3f40a145bb666cbff64a59d3aaba6.zip
Challenge 109 solutions in PHP (translated from Perl)
Diffstat (limited to 'challenge-109/brtastic/php/ch-1.php')
-rw-r--r--challenge-109/brtastic/php/ch-1.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/challenge-109/brtastic/php/ch-1.php b/challenge-109/brtastic/php/ch-1.php
new file mode 100644
index 0000000000..cc5c5e6de3
--- /dev/null
+++ b/challenge-109/brtastic/php/ch-1.php
@@ -0,0 +1,8 @@
+<?php
+
+foreach(range(1, 20) as $num) {
+ echo array_sum(array_filter(
+ $num >= 4 ? range(2, floor($num / 2)) : [],
+ fn ($divisor) => $num % $divisor == 0
+ )) . "\n";
+}