1--TEST-- 2Implicit initialisation when passing by reference 3--FILE-- 4<?php 5function passbyVal($val) { 6 echo "\nInside passbyVal call:\n"; 7 var_dump($val); 8} 9 10function passbyRef(&$ref) { 11 echo "\nInside passbyRef call:\n"; 12 var_dump($ref); 13} 14 15echo "\nPassing undefined by value\n"; 16passbyVal($undef1[0]); 17echo "\nAfter call\n"; 18var_dump($undef1); 19 20echo "\nPassing undefined by reference\n"; 21passbyRef($undef2[0]); 22echo "\nAfter call\n"; 23var_dump($undef2) 24?> 25--EXPECTF-- 26Passing undefined by value 27 28Warning: Undefined variable $undef1 in %s on line %d 29 30Warning: Trying to access array offset on value of type null in %s on line %d 31 32Inside passbyVal call: 33NULL 34 35After call 36 37Warning: Undefined variable $undef1 in %s on line %d 38NULL 39 40Passing undefined by reference 41 42Inside passbyRef call: 43NULL 44 45After call 46array(1) { 47 [0]=> 48 NULL 49} 50