Skip to content

Instantly share code, notes, and snippets.

@jawira
Last active March 15, 2016 09:25
Show Gist options
  • Save jawira/f86e5c7b0cc1bfd33de0 to your computer and use it in GitHub Desktop.
Save jawira/f86e5c7b0cc1bfd33de0 to your computer and use it in GitHub Desktop.
Simple use of constants within a namespace.
<?php
/**
* Created by PhpStorm.
* User: jawira
* Date: 15.03.16
* Time: 10:03
*/
namespace Dummy\MyTime;
const MONTHS = 12;
const WEEKS = 52;
const DAYS = 365;
namespace Test;
use Dummy\MyTime;
$daysPerWeek = MyTime\DAYS / MyTime\WEEKS;
$daysPerMonth = MyTime\DAYS / MyTime\MONTHS;
echo "Days per week: $daysPerWeek\n";
echo "Days per month: $daysPerMonth\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment