Re: define() an array?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, April 26, 2007 5:43 am, Tijnema ! wrote:
> On 4/20/07, Richard Lynch <ceo@xxxxxxxxx> wrote:
>> On Fri, April 20, 2007 4:46 am, lists@xxxxxxxxxxx wrote:
>> > I thought I could define() and array. However, when I do this:
>>
>> Nope. :-(
>>
>> Has to be string or int or boolean or float or other "scalar" type.
>>
>> > define("THECONSTANT", array(1,2,3));
>> > print_r(THECONSTANT);
>> >
>> > it prints THECONSTANT and not the array :(
>> >
>> > according to the manual:
>> >
>> > bool define ( string $name, mixed $value [, bool
>> $case_insensitive] )
>> >
>> > And isn't "mixed" of any type?
>>
>> No.
>>
>> "mixed" just means it's 2 or more types.
>>
>> There could be all kinda of reasons/cases where "mixed" means only
>> scalars, or only compound types or, really, any 2 types you'd care
>> to
>> choose.
>
> So, why isn't such stuff in the manual?
>
> It could be under Paramaters:
> value
> The value of the constant.
> Or, perhaps replacing the mixed by scalar $value.

The fact that you can only have a scalar for the value of a constant
is documented here:
http://us2.php.net/manual/en/language.constants.php

It would be nice, perhaps, to have it also documented in the 'define'
function page, but there it is...

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux