8e34cbdf15
ArrayGet has fairly minimal side-effects: IncRef of its result, and raising a warning if the element is undefined. To CSE ArrayGet, replace it with an IncRef of its destination. Raising multiple warnings for repeated accesses doesn't seem to have much value, so just ignore them.
11 linhas
173 B
PHP
11 linhas
173 B
PHP
<?php
|
|
// Copyright 2004-present Facebook. All Rights Reserved.
|
|
|
|
function array_cse() {
|
|
$a = array(0,1,2,3,4);
|
|
$x = $a[2] + $a[2];
|
|
return $x;
|
|
}
|
|
|
|
var_dump(array_cse());
|