开发者

PHP constant case

I was wondering if I can set a pre defined parameter value in PHP to lower case instead of upper case as in the example below?

Example 1 -开发者_开发百科 upper case:

imagefilter($im, IMG_FILTER_GRAYSCALE)

Example 2 - lower case:

imagefilter($im, img_filter_grayscale)


A constant is case-sensitive by default

see PHP manual: Constants

And why would you want to do this?


constants, like IMG_FILTER_GRAYSCALE, are case-sensitive in PHP per default (http://php.net/manual/en/language.constants.php)


I think this is only achievable if you define the wanted lowercase name with the uppercase name, hence that would not be useful and you are/will create duplicated pieces of code, while not necessary..

why would you want to do this anyway ?

Info about PHP constants can be found here Constants

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜