1--TEST--
2Returning a reference from a function
3--FILE--
4<?php
5function returnConstantByValue() {
6	return 100;
7}
8
9function &returnConstantByRef() {
10	return 100;
11}
12
13function &returnVariableByRef() {
14	return $GLOBALS['a'];
15}
16
17echo "\n---> 1. Trying to assign by reference the return value of a function that returns by value:\n";
18unset($a, $b);
19$a = 4;
20$b = &returnConstantByValue();
21$a++;
22var_dump($a, $b);
23
24echo "\n---> 2. Trying to assign by reference the return value of a function that returns a constant by ref:\n";
25unset($a, $b);
26$a = 4;
27$b = &returnConstantByRef();
28$a++;
29var_dump($a, $b);
30
31echo "\n---> 3. Trying to assign by reference the return value of a function that returns by ref:\n";
32unset($a, $b);
33$a = 4;
34$b = &returnVariableByRef();
35$a++;
36var_dump($a, $b);
37
38?>
39--EXPECTF--
40
41---> 1. Trying to assign by reference the return value of a function that returns by value:
42
43Strict Standards: Only variables should be assigned by reference in %s on line 17
44int(5)
45int(100)
46
47---> 2. Trying to assign by reference the return value of a function that returns a constant by ref:
48
49Notice: Only variable references should be returned by reference in %s on line 7
50int(5)
51int(100)
52
53---> 3. Trying to assign by reference the return value of a function that returns by ref:
54int(5)
55int(5)
56