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.180 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.179 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.178 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.177 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.176 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.175 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.174 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.173 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.172 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.171 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.170 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.169 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.167 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.166 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.165 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.164 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.163 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.162 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.161 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.160 tracks/php/exercises/sum-of-multiples/example.php