From a766d79da3c97cd07e26db3672f3a0b52697f058 Mon Sep 17 00:00:00 2001 From: MathiasReker Date: Fri, 17 Jun 2022 15:36:35 +0200 Subject: [PATCH] Increment style Pre- or post-increment and decrement operators should be used if possible. --- cal.php | 8 ++++---- images/elephpants.php | 2 +- manual/vote-note.php | 4 ++-- releases/index.php | 6 +++--- security/index.php | 2 +- submit-event.php | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/cal.php b/cal.php index ed02e43d08..04a78ec210 100644 --- a/cal.php +++ b/cal.php @@ -173,18 +173,18 @@ "\n",'',"\n"; // Print out headers for weekdays -for ($i = 0; $i < 7; $i++) { +for ($i = 0; $i < 7; ++$i) { echo '', date("l",mktime(0,0,1,4,$i+1,2001)), "\n"; } echo "\n"; // Generate the requisite number of blank days to get things started -for ($days = $i = date("w",$bom); $i > 0; $i--) { +for ($days = $i = date("w",$bom); $i > 0; --$i) { echo ' '; } // Print out all the days in this month -for ($i = 1; $i <= date("t",$bom); $i++) { +for ($i = 1; $i <= date("t",$bom); ++$i) { // Print out day number and all events for the day echo ' '; } diff --git a/images/elephpants.php b/images/elephpants.php index 4b51650eb2..bf7b891742 100644 --- a/images/elephpants.php +++ b/images/elephpants.php @@ -74,7 +74,7 @@ continue; } - $got++; + ++$got; // add photo to response array. $elephpants[] = array( 'title' => $photo['title'], diff --git a/manual/vote-note.php b/manual/vote-note.php index 4831c85d1f..349c9940ab 100644 --- a/manual/vote-note.php +++ b/manual/vote-note.php @@ -61,10 +61,10 @@ } else { if ($_REQUEST['vote'] == 'up') { - $N[$_REQUEST['id']]['votes']['up']++; + ++$N[$_REQUEST['id']]['votes']['up']; } elseif ($_REQUEST['vote'] == 'down') { - $N[$_REQUEST['id']]['votes']['down']++; + ++$N[$_REQUEST['id']]['votes']['down']; } $update = $N[$_REQUEST['id']]['votes']['up'] - $N[$_REQUEST['id']]['votes']['down']; $hash = substr(md5($_REQUEST['page']), 0, 16); diff --git a/releases/index.php b/releases/index.php index 1049b7532d..20f0e211fa 100644 --- a/releases/index.php +++ b/releases/index.php @@ -36,7 +36,7 @@ $release['supported_versions'] = $supportedVersions[$ver] ?? []; } $machineReadable[$version] = $release; - $count++; + ++$count; } } @@ -100,7 +100,7 @@ $i = 0; foreach($a as $ver => $release) { - $i++; + ++$i; mk_rel( $major, $ver, @@ -172,7 +172,7 @@ function recentEOLBranchesHTML(int $count): string { foreach (get_eol_branches() as $major => $branches) { foreach ($branches as $branch => $detail) { $detail_date = $detail['date']; - while (isset($eol[$detail_date])) $detail_date++; + while (isset($eol[$detail_date])) ++$detail_date; $eol[$detail_date] = sprintf('
  • %s: %s
  • ', $branch, date('j M Y', $detail_date)); } } diff --git a/security/index.php b/security/index.php index dbccfbca14..6390d52284 100644 --- a/security/index.php +++ b/security/index.php @@ -43,7 +43,7 @@ $RECORDS[$record_no]["id"] = $record_no; } $field = null; - $record_no++; + ++$record_no; continue; } if(preg_match("/^([-\w]+):\s*(.*)/", $s, $m)) { diff --git a/submit-event.php b/submit-event.php index 055c694d6d..ecc7992183 100644 --- a/submit-event.php +++ b/submit-event.php @@ -151,10 +151,10 @@ if (count($errors)) { display_errors($errors); } // Generate days and months arrays for form -for ($i = 1; $i <= 7; $i++) { +for ($i = 1; $i <= 7; ++$i) { $days[$i] = date('l', mktime(12, 0, 0, 4, $i)); } -for ($i = 1; $i <= 12; $i++) { +for ($i = 1; $i <= 12; ++$i) { $months[$i] = date('F', mktime(12, 0, 0, $i, 1)); }