<?php
function array_display($array, $pre=FALSE){
$tag = $pre ? 'pre' : 'p';
printf("<%s>%s</%s>\n", $tag, var_export($array, TRUE), $tag);
}
$fruits = array('red' => 'apple', 'yellow' => 'banana', 'green' => 'lime');
$colors = array_keys($fruits);
$flavors = array_values($fruits);
array_display($fruits);
array_display($colors);
array_display($flavors);
?>
|