I have the following array:
Array (
[1] => Array (
[spubid] => A00319
[sentered_by] => pubs_batchadd.php
[sarticle] => Lateral m
Just for fun. If you really want to avoid loops, try this:
// Pre PHP 5.3:
function cb2($e)
{
return $e['slast'] . ', ' . $e['sfirst'];
}
function cb1($e)
{
$authors = array_map('cb2', $e['authors']);
echo implode('; ', $authors) . ":
\n" . $e['sarticle'] . "
\n";
}
array_walk($data, 'cb1');
// PHP 5.3 (untested):
array_walk($data, function($e)
{
$authors = array_map(function($e)
{
return $e['slast'] . ', ' . $e['sfirst'];
},
$e['authors']);
echo implode('; ', $authors) . ":
\n" . $e['sarticle'] . "
\n";
});