$arrays = array('girlfriends','wives','employees','bosses');
$girlfriends = array('Lucy','Penelope','Monica');
$wives = array('Casey','Danielle','Teresa');
$employees = array('Mark','Cindy','John');
$bosses = array('Jason','Chuck','Sherry');
foreach( $arrays as $array ) {
echo '<h2>'.ucfirst($array).'</h2>';
echo listArray($$array);
}
I dunno I guess I don't see the question, you want to type echo array_name($girlfriends) instead of echo 'girlfriends' so you are trying to type extra things!
Also it seems like this is exactly what Multi-Dimensional arrays are for:
$people = array(
'girlfriends' => array('Lucy','Penelope','Monica'),
'wives' => array('Casey','Danielle','Teresa'),
'employees' => array('Mark','Cindy','John'),
'bosses' => array('Jason','Chuck','Sherry'),
);
foreach( $people as $type => $names ) {
echo '<h2>'.ucfirst($type).'</h2><ul>';
foreach( $names as $name ) {
echo '<li>'.ucfirst($name).'</li>';
}
echo '</ul>';
}