Assuming that your id
s are unique (!), you could simply use an associative array instead:
$yourArrray = array(
2 => array('title' => 'Test', 'alt_text' => 'This is test'),
3 => array('title' => 'Test1', 'alt_text' => 'This is test1'),
7 => array('title' => 'Test2', 'alt_text' => 'This is test2')
);
This way, your lookup would be as easy as:
$yourArray[$id]['title']
For example:
$title = $yourArray[2]['title'] // $title Now contains "Test"
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…