com web/bugs: Refactor each() function to foreach(): include/functions.php

From: Date: Sat, 24 Nov 2018 01:25:23 +0000
Subject: com web/bugs: Refactor each() function to foreach(): include/functions.php
Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-27458@lists.php.net to get a copy of this message
Commit: 38212625bd3c4356c1173c0ef4fd3af76f404fb5 Author: Peter Kokot <peterkokot@gmail.com> Sat, 24 Nov 2018 02:25:23 +0100 Parents: 0818111ce98a81dcf40ec23c7707ae7804443567 Branches: master Link: http://git.php.net/?p=web/bugs.git;a=commitdiff;h=38212625bd3c4356c1173c0ef4fd3af76f404fb5 Log: Refactor each() function to foreach() The each() function has been deprecated since PHP 7.2 and shouldn't be used anymore: - http://php.net/manual/en/function.each.php Changed paths: M include/functions.php Diff: diff --git a/include/functions.php b/include/functions.php index 13b9c64..cb6d6aa 100644 --- a/include/functions.php +++ b/include/functions.php @@ -498,7 +498,7 @@ function show_byage_options($current) '30' => '30 days ago', '90' => '90 days ago', ]; - while (list($k,$v) = each($opts)) { + foreach ($opts as $k => $v) { echo "<option value=\"$k\"", ($current==$k ? ' selected="selected"' : ''), ">$v</option>\n"; } } @@ -784,7 +784,7 @@ function show_package_options($current, $show_any, $default = '') function show_boolean_options($current) { $options = ['any', 'all', 'raw']; - while (list($val, $type) = each($options)) { + foreach ($options as $val => $type) { echo '<input type="radio" name="boolean" value="', $val, '"'; if ($val === $current) { echo ' checked="checked"';

« previous php.webmaster (#27458) next »