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.139 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.138 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.137 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.136 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.135 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.134 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.133 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.132 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.131 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.130 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.129 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.128 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.127 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.126 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.125 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.124 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.123 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.122 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.121 tracks/php/exercises/sum-of-multiples/example.php
trackler-2.2.1.120 tracks/php/exercises/sum-of-multiples/example.php