1--TEST-- 2Returning a references returned by another function 3--FILE-- 4<?php 5 6 7function &returnVarByRef () { 8 $b=1; 9 return $b; 10} 11 12function &testReturnVarByRef() { 13 return returnVarByRef(); 14} 15 16function returnVal () { 17return 1; 18} 19 20function &testReturnValByRef() { 21 return returnVal(); 22} 23 24echo "\n---> 1. Return a variable by reference -> No warning:\n"; 25 26var_dump (testReturnVarByRef()); 27 28echo "\n---> 2. Return a value by reference -> Warning:\n"; 29 30var_dump (testReturnValByRef()); 31--EXPECTF-- 32---> 1. Return a variable by reference -> No warning: 33int(1) 34 35---> 2. Return a value by reference -> Warning: 36 37Notice: Only variable references should be returned by reference in %s on line %d 38int(1) 39