php-src/tests/lang/returnByReference.002.phpt
Nikita Popov 45f7b2bcc8 Fix CRLF line-endings in tests
Also fix a single instance of CRLF in ibase_query.c.
2016-11-20 22:31:24 +01:00

30 lines
487 B
PHP

--TEST--
Returning a reference from a function.
--FILE--
<?php
function &returnRef() {
global $a;
return $a;
}
function returnVal() {
global $a;
return $a;
}
$a = "original";
$b =& returnVal();
$b = "changed";
var_dump($a); //expecting warning + "original"
$a = "original";
$b =& returnRef();
$b = "changed";
var_dump($a); //expecting "changed"
?>
--EXPECTF--
Notice: Only variables should be assigned by reference in %s on line 13
string(8) "original"
string(7) "changed"