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.119 tracks/php/exercises/meetup/example.php
trackler-2.2.1.118 tracks/php/exercises/meetup/example.php
trackler-2.2.1.117 tracks/php/exercises/meetup/example.php
trackler-2.2.1.116 tracks/php/exercises/meetup/example.php
trackler-2.2.1.115 tracks/php/exercises/meetup/example.php
trackler-2.2.1.114 tracks/php/exercises/meetup/example.php
trackler-2.2.1.113 tracks/php/exercises/meetup/example.php
trackler-2.2.1.111 tracks/php/exercises/meetup/example.php
trackler-2.2.1.110 tracks/php/exercises/meetup/example.php
trackler-2.2.1.109 tracks/php/exercises/meetup/example.php
trackler-2.2.1.108 tracks/php/exercises/meetup/example.php
trackler-2.2.1.107 tracks/php/exercises/meetup/example.php
trackler-2.2.1.106 tracks/php/exercises/meetup/example.php
trackler-2.2.1.105 tracks/php/exercises/meetup/example.php
trackler-2.2.1.104 tracks/php/exercises/meetup/example.php