meridian wrote :
> Thanks Ingo,
> It wasn't a real world problem. I'm trying to learn some Java & Ruby
> (I normally use python).
> So when Ruby's basic examples showed this:
> a = [ 3.14159, "pie", 99 ]
> a.type » Array
> a.length » 3
> a[0] » 3.14159
> a[1] » "pie"
> a[2] » 99
> a[3] » nil
> I thought, yep I can do that in python but I couldn't in Java.
> I can now though... thanks.
> Wasn't advocating any preference about typing etc.
Ok, but what you are really doing here is using an array as a container
for properties. In Java you would create a class with these properties
and use get/set to access them.
That way, when you want to pass the container to a method, you get the
compiler to ensure that the right container (object) gets passed in.
In PHP, all you can do is "hope" that the right array was passed in.
If you use an Object array, you are back to hoping that the right
Object array gets passed in.
--
Wojtek