mirror of
https://github.com/php/web-php.git
synced 2026-03-23 23:02:13 +01:00
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
This commit is contained in:
@@ -21,7 +21,8 @@ if (isset($_SERVER['argv'][2])) {
|
||||
$info = $RELEASES[$major][$version];
|
||||
} else {
|
||||
// Calling without a minor will just grab the most recent minor.
|
||||
list($version, $info) = each($RELEASES[$major]);
|
||||
$version = key($RELEASES[$major]);
|
||||
$info = current($RELEASES[$major]);
|
||||
}
|
||||
|
||||
$info["date"] = ${"PHP_{$major}_DATE"};
|
||||
|
||||
@@ -13,7 +13,7 @@ $test_add = array (
|
||||
"asasasd324324@php.net", "jcastagnetto-delete-this-@yahoo.com",
|
||||
"wrong-address-with@@@@-remove_me-and-some-i-hate_SPAM-stuff");
|
||||
|
||||
while (list(,$v) = each($test_add)) {
|
||||
foreach ($test_add as $v) {
|
||||
echo "The address: $v (".clean_AntiSpam($v).") is";
|
||||
if (!is_emailable_address(clean_AntiSPAM($v)))
|
||||
echo " not";
|
||||
|
||||
@@ -302,7 +302,7 @@ if (isset($_POST['maillist'])) {
|
||||
function output_lists_table($mailing_lists)
|
||||
{
|
||||
echo '<table cellpadding="5" border="0" class="standard mailing-lists">', "\n";
|
||||
while ( list(, $listinfo) = each($mailing_lists)) {
|
||||
foreach ($mailing_lists as $listinfo) {
|
||||
if (!is_array($listinfo)) {
|
||||
echo "<tr><th>{$listinfo}</th><th>Moderated</th><th>Archive</th>" .
|
||||
"<th>Newsgroup</th><th>Normal</th><th>Digest</th></tr>\n";
|
||||
|
||||
@@ -23,8 +23,7 @@ if (is_official_mirror()) {
|
||||
|
||||
// Iterate through possible mirror provider logo types in priority order
|
||||
$types = array("gif", "jpg", "png");
|
||||
while (list(,$ext) = each($types)) {
|
||||
|
||||
foreach ($types as $ext) {
|
||||
// Check if file exists for this type
|
||||
if (file_exists("backend/mirror." . $ext)) {
|
||||
|
||||
|
||||
@@ -52,7 +52,8 @@ if (isset($_GET["serialize"]) || isset($_GET["json"])) {
|
||||
}
|
||||
} else {
|
||||
foreach($RELEASES as $major => $release) {
|
||||
list($version, $r) = each($release);
|
||||
$version = key($release);
|
||||
$r = current($release);
|
||||
$r["version"] = $version;
|
||||
$machineReadable[$major] = $r;
|
||||
}
|
||||
|
||||
9
ug.php
9
ug.php
@@ -42,7 +42,11 @@ function ug_get_next_even_from_ical_array($ical) {
|
||||
$data = array();
|
||||
foreach($ical as $line) {
|
||||
if ($line == "BEGIN:VEVENT") {
|
||||
do {
|
||||
foreach ($ical as $n => $line) {
|
||||
if ("END:VEVENT" == $line) {
|
||||
break;
|
||||
}
|
||||
|
||||
if ($line[0] == " ") {
|
||||
// data continued from previous key
|
||||
$data[$lastkey] .= ltrim($line);
|
||||
@@ -50,7 +54,8 @@ function ug_get_next_even_from_ical_array($ical) {
|
||||
list($lastkey, $value) = explode(":", $line, 2);
|
||||
$data[$lastkey] = $value;
|
||||
}
|
||||
} while((list($n, $line) = each($ical)) && $line != "END:VEVENT");
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user