Sha256: a6f387b436641ec13f6516caaddb3f5730663908401e1906bbfb6ebe8944e430

Contents?: true

Size: 368 Bytes

Versions: 229

Compression:

Stored size: 368 Bytes

Contents

<?php

function sumOfMultiples($number, $multiples)
{
    $numbers = [];
    for ($i = 1; $i < $number; $i++) {
        foreach ($multiples as $multiple) {
            $testNumber = $multiple * $i;
            if ($testNumber < $number) {
                array_push($numbers, $testNumber);
            }
        }
    }
    return array_sum(array_unique($numbers));
}

Version data entries

229 entries across 229 versions & 1 rubygems

Version Path
trackler-2.2.1.78 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.77 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.76 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.75 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.74 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.73 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.72 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.71 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.70 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.69 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.68 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.67 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.66 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.65 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.64 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.63 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.62 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.61 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.60 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.59 tracks/php/exercises/sum-of-multiples/example.php