RE: [PHP] Declare Function
| From: | Ford, Mike [LSS] | Date: | Tue, 15 Apr 2003 10:06:00 +0000 |
| Subject: | RE: [PHP] Declare Function | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-143891@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Frappy John [mailto:frappyjohn@dos2linux.org]
> Sent: 15 April 2003 05:42
>
> Burhan:
>
> You asked a very good question. I've wondered if there's a
> good use for PHP's declared constants too. And I hope
> someone who understands them replies with a good
> explanation.
Constants aren't "declare"d, they are "define"d -- declare() is for
something else entirely.
>
> I see where one reply so far identified them as a
> "constant." That's PHP's term. But they aren't really
> constants in the traditional sense since you can't use them
> in expressions.
What???? Where did you get that impression?? Absolutely they can be used in expressions -- what on
earth would be the point of them otherwise?
define("TWO", 2);
$four = 2*TWO;
$four is now 4.
> I see where another reply called them "execution
> parameters," (which to my mind is just a fancy term for
> "constant").
See my first comment -- PHP's execution parameters are something else completely, and are
"declare"d, not "define"d!
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.ford@lmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211