Q:

Error in for loop?

I've just gotten into PHP progamming, and I have an error in my for loop. When I cut it out, the code runs fine.
<?php

// Utils
function contains($needle, $haystack) {
    return strpos($haystack, $needle) !== false;
}

$client_ip = $_SERVER['REMOTE_ADDR'];

$iphitsfile = fopen("iphits.txt","r");
$iphits = fgets($iphitsfile,1000);
fclose($iphitsfile);

echo $iphits;

$ips = split(" ", $iphits);

for($ip_and_hits : $ips) {
    echo "$ip_and_hits";
    $ip = split("-", $ip_and_hits);
    $hits = split("-", $ip_and_hits);

    if($ip == $client_ip) {
        $hits = $hits + 1;

        $iphits = str_replace($ip_and_hits,$ip."-".$hits." ",$iphits);

        $iphitsfile = fopen("iphits.txt","w");
        fwrite($iphitsfile, $iphits);
        fclose($iphitsfile);

        break;
    }

}

?>

A:

What you wrote, for($ip_and_hits : $ips) { is Java-like syntax.
In PHP, you need to use a foreach loop:
foreach ($ips as $ip_and_hits) {

