[eluser]obiron2[/eluser]
Guys,
I am writing my first fully OOP application; its a fantasy formula 1 league.
I have an object (PlayerTeam) which is a collection of objects (Driver 1, Driver 2, Chassis etc..)
Each object in the collection has a number of properties (name, points etc..)
I have a function which gets a list of all the teams and builds their profiles.
I have a function which gets the race results.
For each team I then loop through the race results and increment the points for each element of the team so that I know how many points Driver 1, Driver 2 and the car have scored.
I also want to build an array as part of the team object which is the individual race results for that team.
Code:
$team->Race->results[$Race->Venue] = $Race->Results.
but when I do this the result always displays the values from the last $Race; i.e. passed by reference
If I do
Code:
$team->Race->results[$Race->Venue] = $Race->Results->Driver1->RacePoints
Then the results are all different; i.e. passed by value.
Am I right in thinking that this is correct. If so, why does PHP treat these differently and how do I pass the object by value to the array.
Thanks in Advance.
Obiron