Re: Constant Parameters
| From: | Pierre | Date: | Fri, 02 Mar 2007 20:26:07 +0000 |
| Subject: | Re: Constant Parameters | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-28207@lists.php.net to get a copy of this message | ||
On 3/2/07, Jakob Buchgraber <jakob.buchgraber@gmail.com> wrote:
Marco Kaiser wrote: Hi Jakob,It actually comes from the C/C++ "const" like foo(const char *str). It makes very little sense to have it in PHP. --PierreThis makes absolute no sense, why you want this? -- Marco It's just a way of ensuring that a parameter cannot be changed within a method (e.g. an id). I am using this feature frequently in Java. It actually got no "deeper" sense, but it's just a nice feature I'd like to use in PHP too. :-)It would be nice if in PHP 6 using constant parameters for functions and methods would be possible. This feature is e.g. available in Java. function doSth (const A) {if (defined ("A")) echo "A is a constant";} doSth ("foo"); Cheers, Jay