Forum Moderators: phranque
php-4.3.10-2.4, scripts with the foreach loop don't work properly. They do work on other machines so it's no scripting issue as such. And php seems to be installed OK.
Contemplating the reinstall of PHP but before I do so maybe any tips as to what would be the cause of this PHP half working.
Thx
<?
#foreach ($arr1 as $i) {action}
# as is the assignment
#integers no quotes req.
$arr1 =array(1,2,3,4,5);
#keys and values
$arr2 =array("file1" => "index.php","file2" => "default.php",);
#values only
$arr3 =array("index1.html","index2.html");
foreach ($arr1 as $i) {
echo $i, "<br>";
}
#echo both key and value
foreach ($arr2 as $key => $index) {
echo "$key - $index", "<br>";
}
foreach ($arr3 as $index) {
echo $index, "<br>";
}
?>
Instead of dispaying
1
2
3
4
5
it shows
array
array
array
But only on this one machine, works fine elsewhere.