<?php

$i = 1;
$arr = array("xyz" => array(1 => 3, 0 => "s"), "ds2" => array("a" => 96, "d" => 4), "foo" => array("test", "this"), "bar00" => array(0,1), "abc1" => array(2,3), "stack" => array("test", "arr"));

foreach ($arr AS $index => $value) {
	 
        // Assuming there are only 2 values, pop the last value
	$secondVal = array_pop($value);

	echo "$index: $secondVal\n";
	
	// Don't continue if 5 elements have been outputted
	if ($i >= 5)
		break;
		
	$i++;
}

foreach ($arr AS $index => $value) {
	// Remove the element if the index contains non-alpha characters
	if (preg_match('/[^A-Za-z]/', $index))
		unset($arr[$index]);
}

print_r($arr);

?>