From f78ef0cd391bbbb3ae2a90076b8d496b5f2755f7 Mon Sep 17 00:00:00 2001 From: Raphael Martin Date: Tue, 16 Jan 2024 17:23:38 +0100 Subject: [PATCH] initial commit --- README.md | 7 +++++++ index.php | 31 +++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 index.php diff --git a/README.md b/README.md index 9c17376..ea6e206 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,9 @@ # php_pimebday +## requierments + + - php > 7.4 + +## execute + +execute the index.php from your web server diff --git a/index.php b/index.php new file mode 100644 index 0000000..60b8640 --- /dev/null +++ b/index.php @@ -0,0 +1,31 @@ + 0) { + for ($age = 32; $age <= $ageLimit; $age++) { + $primenum = true; + for($denominator = 2; $denominator <= $age/2; $denominator++) { + if(((float)$age % (float)$denominator) == 0.0) { + $primenum = false; + break; + } + } + if ((bool)$primenum) { + $out[] = $age; + $countNextBdays--; + if($countNextBdays == 0){ + break; + } + } + } + + } + return $out; +} + +echo json_encode(getNextPrimeBdays(32,10)); \ No newline at end of file