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.38 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.37 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.36 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.35 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.34 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.33 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.32 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.31 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.30 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.29 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.28 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.27 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.26 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.25 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.24 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.23 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.22 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.21 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.20 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.19 tracks/php/exercises/sum-of-multiples/example.php