Re: Array Question

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

 



On Wed, 2007-07-11 at 16:11 -0500, Richard Lynch wrote:
> On Wed, July 11, 2007 9:52 am, Stut wrote:
> >>     $needle = (array)$needle;
> >>
> >> Conversion to array creates an array with one element... the value
> >> converted.
> >
> > Without raising a notice?
> 
> Sure looks like it:
> php -d error_reporting=2047 -r '$foo = (array) "foo"; var_dump($foo);'
> array(1) {
>   [0]=>
>   string(3) "foo"
> }
> 
> But I'd have to say that the intent is not all that clear, really, and
> I'd be leery of this feature, personally.

I wouldn't be leery at all. It's been around for a very long time and
it's documented:


http://www.php.net/manual/en/language.types.array.php#language.types.array.casting

Cheers,
Rob.
-- 
...........................................................
SwarmBuy.com - http://www.swarmbuy.com

    Leveraging the buying power of the masses!
...........................................................

-- 
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