View Single Post
  #3  
Old 04-16-2008, 03:11 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
You can't get the index of a subaray in an array without a loop.

PHP Code:
// ...

this.array = {{"Frankie", 2000}, {"TSAdmin", 1500}};
this.getIndex = index2(this.array, "Frankie");
echo(
this.array[this.getIndex][0] SPC "found!");

// ...

function index2(array, acc)
{
  for (
temp.arg: array) {
    if (
temp.arg[0] == acc) return array.index(temp.arg);
  }
  return -
1;
} 
EDIT: Bah, Pfa beat me too it!
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote