I use the following to take an array called $list
and turn it into URLs:
function genIMG($sValue) {
return 'http://asite.com/'.$sValue.'?&fmt=jpg';
}
$IMGurls = array_map("genIMG", array_unique($list));
foreach($IMGurls as $imgLink) {
echo "<a href='". $imgLink ."'>". $imgLink ."</a><br />";
}
This works, but I also have some null
values in the array. How can I have the array map ignore any values of null? Otherwise it just creates something like this:
http://asite.com/?&fmt=jpg
with no file name since it was null.