jquery - Javascript get key of multidimensional array - Stack Overflow

I've the following array: $test[$iterator][1][2]['name']I have a function that needs to

I've the following array:

$test[$iterator][1][2]['name']

I have a function that needs to get $iterator of that array when ['name'] == 'value';

So how can I use Javascript to get the given $iterator?

Also, I did look at other questions, but I'm not sure if their answers apply to my question.

I've the following array:

$test[$iterator][1][2]['name']

I have a function that needs to get $iterator of that array when ['name'] == 'value';

So how can I use Javascript to get the given $iterator?

Also, I did look at other questions, but I'm not sure if their answers apply to my question.

Share Improve this question edited Jul 22, 2012 at 18:38 Jared Farrish 49.3k17 gold badges99 silver badges107 bronze badges asked Jul 22, 2012 at 18:33 AdolaAdola 5887 silver badges21 bronze badges 1
  • PHP or JavaScript? The $ seems a little strange. – Ry- Commented Jul 22, 2012 at 18:39
Add a ment  | 

1 Answer 1

Reset to default 8

Are you looking for something like this?

var $iterator;
for (var i = 0; i < $test.length; i++) {
    if ($test[i][1][2]['name'] == 'value')
    {
        $iterator = i;
        break;
    }
}

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745325527a4622638.html

相关推荐

  • jquery - Javascript get key of multidimensional array - Stack Overflow

    I've the following array: $test[$iterator][1][2]['name']I have a function that needs to

    5小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信