Re: (array)
| From: | Ray Hauge | Date: | Wed, 22 Feb 2006 22:48:12 +0000 |
| Subject: | Re: (array) | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-230911@lists.php.net to get a copy of this message | ||
On Wednesday 22 February 2006 15:09, John Nichel wrote:
> Jay Paulson wrote:
> > Just came across some code I haven't seen before and can't find anything
> > on php.net or google about it (maybe I'm not searching for the right
> > thing?). What is the following doing?
> >
> > // $dataobject is holding a bunch of variables like:
> > // $dataobject->var1
> > // $dataobject->var2
> > // etc...
> >
> > (array)$dataobject;
> >
> > Is this making the $dataobject an associative array like:
> >
> > $dataobject["var1"]
> > $dataobject["var2"]
> >
> > Or is it doing something different?
>
> Yes, I believe it's type-casting the object into an array. Do a print_r
> ( $dataobject ) on it before and after the casting.
>
> --
> John C. Nichel IV
> Programmer/System Admin (ÜberGeek)
> Dot Com Holdings of Buffalo
> 716.856.9675
> jnichel@dotcomholdingsofbuffalo.com
I was curious about this myself, so I took a look at the "Types" section of
the PHP manual, and an array is really a compound type. With that in mind it
makes sense that you could typecast to an array.
http://www.php.net/manual/en/language.types.php
--
Ray Hauge
Programmer/Systems Administrator
American Student Loan Services
http://www.americanstudentloan.com
1.800.575.1099