| 
	
 | 
 Posted by Yarco on 08/02/07 04:05 
Because we could use it like Date::$MONTH_NAMES[1]. 
No need to call function. 
 
On Aug 2, 11:54 am, Joeseph P. Blow <jpb...@gmail.com> wrote: 
> On Thu, 02 Aug 2007 03:48:43 -0000, Yarco <yarc...@gmail.com> top 
> posted like an ignorant fucking moron and wrote: 
> 
> >Yes, it can be done like this. 
> >But cause $MONTH_NAMES is variable, someone could change the value. 
> 
> >// Data.cls.php 
> > class Date { 
> >  public static $MONTH_NAMES = array('January', ...); 
> >} 
> 
> Why make it public? 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> >// Plugin.php 
> >Date::$MONTH_NAMES = null; // someone don't know the meaning of the 
> >variable 
> 
> >// Template.php 
> >print Date::$MONTH_NAMES[1]; // then your code doesn't work 
> 
> >On Aug 2, 11:01 am, Hendri Kurniawan <hckurnia...@gmail.com> wrote: 
> >> On Aug 2, 12:55 pm, Yarco <yarc...@gmail.com> wrote: 
> 
> >> > Array is the very basic type in php i think. So why const keyword 
> >> > doesn't support such defination grammar? 
> 
> >> > class Date 
> >> > { 
> >> >   const char3 = array(1 => 'Jan', ...); // ?? 
> 
> >> > } 
> 
> >> > So how can i do somthing like c++'s enum? 
> 
> >> > class Data 
> >> > { 
> >> >   const Jan = 1; 
> >> >   //... 
> 
> >> > } 
> 
> >> > is poor if i want to chanslate number to month name. 
> 
> >> Well if you can't have const array, do a public static property 
> >> instead 
> >> class Data { 
> >>   public static $MONTH_NAMES = array('January', ...); 
> 
> >> } 
> 
> >> Hendri Kurniawan 
> 
> -- 
> Just your average Joe
 
  
Navigation:
[Reply to this message] 
 |