Project

General

Profile

Bug #6247

Class File.php: php function 'each' (line 92) is deprecated - replace

Added by Carsten Rose over 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Target version:
Start date:
16.06.2018
Due date:
% Done:

0%

Estimated time:
Spent time:
Discuss:

Associated revisions

Revision 5a62ea7a (diff)
Added by Elias Villiger over 1 year ago

6247 Replace deprecated each function

History

#1 Updated by Benjamin Baer over 1 year ago

What is this? :o
https://secure.php.net/manual/en/control-structures.foreach.php

<?php
$arr = array(1, 2, 3, 4);
foreach ($arr as &$value) {
    $value = $value * 2;
}
// $arr is now array(2, 4, 6, 8)

// without an unset($value), $value is still a reference to the last item: $arr[3]

foreach ($arr as $key => $value) {
    // $arr[3] will be updated with each value from $arr...
    echo "{$key} => {$value} ";
    print_r($arr);
}
// ...until ultimately the second-to-last value is copied onto the last value

// output:
// 0 => 2 Array ( [0] => 2, [1] => 4, [2] => 6, [3] => 2 )
// 1 => 4 Array ( [0] => 2, [1] => 4, [2] => 6, [3] => 4 )
// 2 => 6 Array ( [0] => 2, [1] => 4, [2] => 6, [3] => 6 )
// 3 => 6 Array ( [0] => 2, [1] => 4, [2] => 6, [3] => 6 )
?>

Back to javascript. :p

#2 Updated by Carsten Rose over 1 year ago

  • Assignee set to Elias Villiger

#3 Updated by Elias Villiger over 1 year ago

  • Status changed from New to In Progress

#4 Updated by Elias Villiger over 1 year ago

  • Status changed from In Progress to Closed

#5 Updated by Carsten Rose about 1 year ago

  • Target version changed from 18.10.3 to 18.9.2

Also available in: Atom PDF