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