• R/O
  • SSH
  • HTTPS

jinrousiki: Commit


Commit MetaInfo

Révision2772 (tree)
l'heure2021-08-16 05:24:52
Auteurumethyl

Message de Log

Number::Multiple()

Change Summary

Modification

--- trunk/include/functions.php (revision 2771)
+++ trunk/include/functions.php (revision 2772)
@@ -315,14 +315,19 @@
315315 return $number < $from || $to < $number;
316316 }
317317
318- //偶数
319- public static function Even($number, $limit = null) {
318+ //倍数
319+ public static function Multiple($number, $base, $target, $limit = null) {
320320 if (null === $limit) {
321- return $number % 2 == 0;
321+ return $number % $base == $target;
322322 } else {
323- return $number < $limit || $number % 2 == 0;
323+ return $number < $limit || $number % $base == $target;
324324 }
325325 }
326+
327+ //偶数
328+ public static function Even($number, $limit = null) {
329+ return self::Multiple($number, 2, 0, $limit);
330+ }
326331 }
327332
328333 //-- Switch (bool) 関連 --//
Afficher sur ancien navigateur de dépôt.