eval.in

Paste #492

PHP — PHP 5.4.6, pasted 1 year ago

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
<?php

function &return_a() {
    global $a;
    return $a;
}

$a = [1,2,3];
array_shift(return_a());
print_r($a);

$a = [1,2,3];
array_shift((return_a()));
print_r($a);

Program Output

Array
(
    [0] => 2
    [1] => 3
)
Array
(
    [0] => 1
    [1] => 2
    [2] => 3
)

OK (0.004 sec real, 0.117 sec wall, 13 MB, 94 syscalls)

Fork