note 112695 deleted from function.define by cmb
| From: | cmb@php.net | Date: | Sun, 06 Oct 2019 07:42:41 +0000 |
| Subject: | note 112695 deleted from function.define by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-212459@lists.php.net to get a copy of this message | ||
Note Submitter: php at richardneilll dot org
----
In PHP, define does not have the same gotchas as the C-preprocessor. E.g.
//In PHP:
define ("x", 5+2); //x is evaluated as 7
echo 3 * x; //This is 21, as you'd expect.
//But in C:
#define x 5+2; //x is the string "5+2", substituted later.
printf ("%d", 3*x); //This is 17.