【发布时间】:2015-04-03 05:02:04
【问题描述】:
我有一个用于显示数组内所有图像的 for 循环。我怎样才能把它放在一个函数中,所以当我需要它时,我可以调用它,它会显示所有的图片?
$countArray = count($fil[0]);
function displayAllImages(){
for ($x=0; $x<$countArray; $x++){
echo '<img src="photos/'.$fil[0][$x].'" /><br />';
}
}
displayAllImages(); //nothing shows up
【问题讨论】:
标签: php arrays function for-loop