PHP 7 array_values assignment

raw

phork0.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
$ar = array('foo');
unset($ar[0]);
$ar = array_values($ar);
$ar[] = 'bar';
var_dump($ar);
/*
PHP 5:
array(1) {
  [0] =>
  string(3) "bar"
}
 
PHP 7:
array(1) {
  [1]=>
  string(3) "bar"
}
*/
?>
Christian Weiske Christian Weiske
owner

History