|
Posted by Joeseph P. Blow on 08/02/07 10:35
On Thu, 2 Aug 2007 09:44:17 +0100, Toby A Inkster
<usenet200707@tobyinkster.co.uk> wrote:
>Yarco wrote:
>
>> But cause $MONTH_NAMES is variable, someone could change the value.
>
>If you overload the class' __set() function you can effectively make it
>read-only. (Assuming you're using PHP 5.)
>
>Better though:
>
> function get_month_name ($n, $fmt='M')
> {
> $d = mktime(12, 0, 0, $n, 1, 1970);
> return date($fmt, $d);
> }
Which'd be the near the same as using private, no? Either way, you'd
not have to worry about it getting overrwritten unless you're a bad
programmer who top posts. :)
--
Just your average Joe
Navigation:
[Reply to this message]
|