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