You are here: Re: How about const supporting array in future? « PHP Programming Language « IT news, forums, messages
Re: How about const supporting array in future?

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация