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.159 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.158 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.157 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.156 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.155 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.154 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.153 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.152 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.151 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.150 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.149 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.148 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.147 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.146 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.145 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.144 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.143 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.142 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.141 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.140 tracks/php/exercises/sum-of-multiples/example.php