在PHP中获取多维数组中的数据[关闭]

I've got a problem.

I have got this array:

Array ( 
    [0] => Array ( 
        [id] => 1 
        [opt] => reg_limit
        [value] => 0 
      ) 
    [1] => Array ( 
        [id] => 3 
        [opt] => pages_offline 
        [value] => [] 
       ) 
    [2] => Array ( 
        [id] => 4 
        [opt] => devolp 
        [value] => TRUE 
       ) 
)

I want to check if the [opt] devolp has the [value] TRUE in the third array. How can I do?

Provided you will work with a big array in the future and need some flexibility, this foreach will work for you:

foreach($array as $a) {
    if(array_key_exists("opt", $a) && $a['opt'] == "devolp") {
        if(array_key_exists("value", $a) && $a['value'] == TRUE) {
            echo "Found it!";
            //Do whatever you need to do here....
        }
    }
}
$aArray = Array ( 
[0] => Array ( 
    [id] => 1 
    [opt] => reg_limit
    [value] => 0 
  ) 
[1] => Array ( 
    [id] => 3 
    [opt] => pages_offline 
    [value] => [] 
   ) 
[2] => Array ( 
    [id] => 4 
    [opt] => devolp 
    [value] => TRUE 
   ) 
)

foreach($aArray AS $aInnerArray){
  if($aInnerArray['opt'] == 'devolp' && $aInnerArray['value'] == TRUE){
     //YOUR USE CASE
  }
}
if ($array[2]['value']) echo 'true';

Since the OP's question is quite vague on the details wether or not he knows which array key he needs to check,

Here is a simple example that you can use if you know the array key that you need to check in.

$bool = $yourMultiDeminsionalArray[2]['value'];

if ($bool) {

    //Do some awesome PHP shizzle here

}