PhP多维数组提取

I am not really familiar on how php handles array, in .NET I can access array using this method

array[x][y];

My question is:

I am retrieving records from the database and returning it to the $res_merchant_field

$res_merchant_field = $this->CI->merchantfield_model->merchantfield_list( $str_where );

and $res_merchant_field will be populated with this record:

Array
(
    [0] => stdClass Object
        (
            [MFID] => 1
            [MFName] => Bill No
            [FTID] => 1
            [DTID] => 1
            [MFRequired] => 1
            [MFDefaultValue] => 
            [MFDueDate] => 0
            [MFToBePaid] => 0
            [MFMaxLength] => 12
            [MFOrderNo] => 1
            [MFStatus] => 1
        )

    [1] => stdClass Object
        (
            [MFID] => 2
            [MFName] => Gallons Consumed
            [FTID] => 1
            [DTID] => 2
            [MFRequired] => 1
            [MFDefaultValue] => 
            [MFDueDate] => 0
            [MFToBePaid] => 0
            [MFMaxLength] => 5
            [MFOrderNo] => 2
            [MFStatus] => 1
        )

    [2] => stdClass Object
        (
            [MFID] => 3
            [MFName] => Amount Due
            [FTID] => 3
            [DTID] => 1
            [MFRequired] => 1
            [MFDefaultValue] => 
            [MFDueDate] => 0
            [MFToBePaid] => 1
            [MFMaxLength] => 15
            [MFOrderNo] => 3
            [MFStatus] => 1
        )

)

How can I access and fetch the record from that array with this condition:

  1. it will look through all the array find specific index, lets say index 0 which is MFID,
  2. after getting the MFID and comparing it with another variable, if it is true,
  3. it will get the DTID for that array MFID.

example:

get MFID = 1, the DTID will be 1, if I get the MFID = 3, the DTID will be 1.

or how can I access the array like $array[x][y]?

Thanks in advance.

The problem is that the second level is not an array but instead an object, to access a property you will have to use this format.

 $array[$x]->$y;

Unfortunately you cannot access a property by an index do o get the MFID of the 0th Item you will need to say

 $array[0]->MFID;