I have created a function but in that function there are foreach runs ...
is it posible to return a variable out of the function & foreach run ?
i would like to get out $counter ?
- Code: Select all
function viewFoto($nDir, $iCurrent = 0)
{
if(!is_array($nDir))
{
return false;
}
$sReturn = '';
$counter = 0;
foreach($nDir as $iKey => $sValue)
{
if(is_array($sValue))
{
echo "<img src='".$iKey."/".$sValue."'></img>";
} else
{
echo "<li><a href='Project/".$_GET["id"]."/".$sValue."' rel='lightbox[". $_GET["id"] ."]'><img src='Project/".$_GET["id"]."/".$sValue."' id='showFoto'></img></li></a>\n";
$counter = $counter + 300;
}
}
return;
}

