Posted by Hendri Kurniawan on 08/02/07 03:01
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
[Back to original message]
|