array element wrap all elements
How about array_map?
$links = array('london', 'new york', 'paris');
$wrapped = array_map(
function ($el) {
return "<a href=\"#{$el}\">{$el}</a>";
},
$links
);
Demo (Click source)
Without PHP > 5.3, you can't use a lambda function, so you'll need something like this:
function wrap_those_links($el) {
return "<a href=\"#{$el}\">{$el}</a>";
}
$links = array('london', 'new york', 'paris');
$wrapped = array_map('wrap_those_links', $links);
Demo for PHP 5.2 (Again, click Source)
Try join('\n', array_map(function($a) { return "<a href=\"#$a\",>$a<\\a>";}, $links));