Sha256: 175424b895fadf4e12af3bc0b252607fb370d00059d2e68f9476c18b066b767f

Contents?: true

Size: 475 Bytes

Versions: 75

Compression:

Stored size: 475 Bytes

Contents

<?php

function meetup_day($year, $month, $which, $weekday)
{
    $monthName = (DateTime::createFromFormat("!m", $month))->format('F');
    if ($which != "teenth") {
        return new DateTime("$which $weekday of $monthName $year");
    }

    $date = new DateTime("first $weekday of $monthName $year");
    while ($date->format('F') == $monthName) {
        $date->modify("next $weekday");
        if ($date->format('j') > 12) {
            return $date;
        }
    }
}

Version data entries

75 entries across 75 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/php/exercises/meetup/example.php
trackler-2.2.1.179 tracks/php/exercises/meetup/example.php
trackler-2.2.1.178 tracks/php/exercises/meetup/example.php
trackler-2.2.1.177 tracks/php/exercises/meetup/example.php
trackler-2.2.1.176 tracks/php/exercises/meetup/example.php
trackler-2.2.1.175 tracks/php/exercises/meetup/example.php
trackler-2.2.1.174 tracks/php/exercises/meetup/example.php
trackler-2.2.1.173 tracks/php/exercises/meetup/example.php
trackler-2.2.1.172 tracks/php/exercises/meetup/example.php
trackler-2.2.1.171 tracks/php/exercises/meetup/example.php
trackler-2.2.1.170 tracks/php/exercises/meetup/example.php
trackler-2.2.1.169 tracks/php/exercises/meetup/example.php
trackler-2.2.1.167 tracks/php/exercises/meetup/example.php
trackler-2.2.1.166 tracks/php/exercises/meetup/example.php
trackler-2.2.1.165 tracks/php/exercises/meetup/example.php
trackler-2.2.1.164 tracks/php/exercises/meetup/example.php
trackler-2.2.1.163 tracks/php/exercises/meetup/example.php
trackler-2.2.1.162 tracks/php/exercises/meetup/example.php
trackler-2.2.1.161 tracks/php/exercises/meetup/example.php
trackler-2.2.1.160 tracks/php/exercises/meetup/example.php