1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/tests/lang/returnByReference.009.phpt
Máté Kocsis 7aacc705d0 Add many missing closing PHP tags to tests
Closes GH-5958
2020-08-09 22:03:36 +02:00

40 lines
708 B
PHP

--TEST--
Returning a references returned by another function
--FILE--
<?php
function &returnVarByRef () {
$b=1;
return $b;
}
function &testReturnVarByRef() {
return returnVarByRef();
}
function returnVal () {
return 1;
}
function &testReturnValByRef() {
return returnVal();
}
echo "\n---> 1. Return a variable by reference -> No warning:\n";
var_dump (testReturnVarByRef());
echo "\n---> 2. Return a value by reference -> Warning:\n";
var_dump (testReturnValByRef());
?>
--EXPECTF--
---> 1. Return a variable by reference -> No warning:
int(1)
---> 2. Return a value by reference -> Warning:
Notice: Only variable references should be returned by reference in %s on line %d
int(1)