note 86514 modified in function.define by danbrown
| From: | danbrown@php.net | Date: | Wed, 22 Oct 2008 19:06:09 +0000 |
| Subject: | note 86514 modified in function.define by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-145608@lists.php.net to get a copy of this message | ||
Found something interesting. The following define:
<?php
define("THIS-IS-A-TEST","This is a test");
echo THIS-IS-A-TEST;
?>
Will return a '0'.
Whereas this:
<?php
define("THIS_IS_A_TEST","This is a test");
echo THIS_IS_A_TEST;
?>
Will return 'This is a test'.
This may be common knowledge but I only found out a few minutes ago.
[EDIT BY danbrown AT php DOT net: The original poster is referring to the hyphens versus
underscores. Hyphens do not work in defines or variables, which is expected behavior.]
--was--
Found something interesting. The following define:
<?php
define("THIS-IS-A-TEST","This is a test");
echo THIS-IS-A-TEST;
?>
Will return a '0'.
Whereas this:
<?
define("THIS_IS_A_TEST","This is a test");
echo THIS_IS_A_TEST;
?>
Will return 'This is a test'.
This may be common knowledge but I only found out a few minutes ago.
[EDIT BY danbrown AT php DOT net: The original poster is referring to the hyphens versus
underscores. Hyphens do not work in defines or variables, which is expected behavior.]
http://php.net/manual/en/function.define.php