View Single Post
  #9  
Old 01-25-2010, 07:29 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Grey View Post
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.
__________________
Reply With Quote