btwael / mammouth

Unfancy PHP
http://mammouth.boutglay.com
MIT License
214 stars 22 forks source link

Predefined (magic) constants #20

Closed CezaryDanielNowak closed 10 years ago

CezaryDanielNowak commented 10 years ago

All magic constants should be protected and not begin with $ character.

Why ?

{{
define('MY_CONST', 'fooo')
echo(MY_CONSTANT) # is compiled to echo($MY_CONSTANT); - not good
echo(constant('MY_CONSTANT')) # workaround above problem, write "fooo"

echo(constant('__LINE__')) # error: constant() Couldn't find constant __FUNCTION__ 
}}

so in mammouth you can not access any of magic constants

magic constants reference page: http://www.php.net/manual/pl/language.constants.predefined.php

btwael commented 10 years ago

Fixed but need add more constant, Mybe you can help me to add all predefined constants to Context: https://github.com/btwael/mammouth/blob/master/src/context.coffee