Treefrog
Jul 7 2005, 05:15 PM
Hi all,
I posted this is alt.php but then realised it's probably not the most
applicable group. Sorry for littering. ;o)
I've been using PHP since v3.* but haven't really played with the object
side of things with much depth. I've been coding a lot of c# recently and am
finding the using an ibject approch to my PHP projects is really tidying up
my code and making things much easy to develop.
I'm still using PHP4 because I'm not ready and haven't got time to swap a
live system over to a new environment and deal with any problems....
although I might consider it if PHP4 limits me at all.
My question, well questions, are.
1. Can I create an array that has an object as elements?
i.e. I have a sales object, which has a property "items". Items is an array
of product objects.
Would the code below work, for example.
$sale->items[1]->price or $sale->items[1]->size
2. Can functions return instances of objects?
3. If any of this can't be done in PHP4, is it possible in 5?
Thanks,
Treefrog
Treefrog
Jul 7 2005, 05:37 PM
"Treefrog" <[Email Removed]> wrote in message
news:dajr3q$cs1$[Email Removed]...
QUOTE |
Hi all,
I posted this is alt.php but then realised it's probably not the most applicable group. Sorry for littering. ;o)
I've been using PHP since v3.* but haven't really played with the object side of things with much depth. I've been coding a lot of c# recently and am finding the using an ibject approch to my PHP projects is really tidying up my code and making things much easy to develop. I'm still using PHP4 because I'm not ready and haven't got time to swap a live system over to a new environment and deal with any problems.... although I might consider it if PHP4 limits me at all.
My question, well questions, are.
1. Can I create an array that has an object as elements? i.e. I have a sales object, which has a property "items". Items is an array of product objects. Would the code below work, for example. $sale->items[1]->price or $sale->items[1]->size
2. Can functions return instances of objects?
3. If any of this can't be done in PHP4, is it possible in 5?
Thanks,
Treefrog
|
Nevermind, I have an answer from a nice chap in alt.php.
For anybody wondering (or reading google groups) the asnwer is, it can all
be done.