$previousReading) { $increased++; } $previousReading = $currentReading; } echo $increased; // 1597