搜索多维数组

I have an array that looks like

$arr = array(
     array('contents' => "any value",
           'tags' => '<th>'
     ),

     array('contents' => "any value",
           'tags' => "<th>"

     )
     .
     .
     .
);

I want to echo the value of index "contents"

Use something like

echo $arr["contents"]

To get the values you want...

http://php.net/manual/en/language.types.array.php

Try this

$arr = array(array('contents' => "any value", "tags" => "<th>"),array('contents' => "any value","tags" => "<th>"));

    foreach($arr as $arrays){
        echo $arrays["contents"];
    }

Use this (but you should check the docs to improve your knowledge about arrays):

$arr = array(
     array('contents' => "any value",
           'tags' => '<th>'
     ),

     array('contents' => "any value",
           'tags' => "<th>"

     )
);

foreach ($arr as $token){
    echo $token['contents'];
}

array_walk is quite useful for these kinds of things. It goes through each element of the array and applies a callback function:

array_walk($arr, function($x) { if (isset($x['contents'])) echo $x['contents']; });

Perhaps more simple, you could loop through the elements yourself:

foreach ($arr as $a) { 
    if (isset($a['contents'])) echo $a['contents']; 
}