Re: Array within a Class?
| From: | Chris Hall | Date: | Sun, 06 Jan 2002 00:07:00 +0000 |
| Subject: | Re: Array within a Class? | ||
| References: | 1 2 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-11319@lists.php.net to get a copy of this message | ||
dankeshane Micheal -- ill give it a shot and let ya know how it turns out :)
Chris Hall
hardwired industries
"Michael Sims" <mhsims@midsouth.rr.com> wrote in message
news:5.1.0.14.0.20020105175143.03d6b498@pop-server.midsouth.rr.com...
> At 03:04 PM 1/5/2002 -0800, Chris Hall wrote:
> >Just a quicky --
> >
> >I have yet to see anyone define an array within a class, yet if it is
> >possible, would i be able to access that array with
> >$this->array["variable"];?
>
> I've designed a class that has a method that RETURNS an array, but it
> sounds like you want to define one of the properties of your class as an
> array, i.e.:
>
> class testObject {
>
> var $testarray = array("firstindex" => "firstvalue",
> "secondindex" => "secondvalue");
>
> ...
>
> }
>
> I haven't personally done this, but I can't see why it wouldn't be
> possible. Then if you wanted to access it inside a method you should be
> able to the way you have described, like:
>
> function testMethod () {
>
> return $this->testarray["firstindex"];
> }
>
> Should work....why don't you give it a shot and see what happens? :)
>