Quote:
Originally Posted by Grey
It makes it less than ideal to store objects in arrays as you can't use .index() and other built in functions (because an array of objects will all have the name ""). Would have to run through the array checking .name for each element.
|
Jerret is right. You can compare objects as objects, rather than comparing their names.
PHP Code:
temp.pl = findPlayer("cbk1994");
temp.pl2 = findPlayer("cbk1994");
temp.pl3 = findPlayer("Grey");
echo(pl == pl2); // 1
echo(pl == findPlayer("cbk1994")); // 1
echo(pl == pl3); // 0
hence why you can also use "in" and functions like "index", as fowlplay said.