note 28501 modified in language.variables by danbrown
| From: | danbrown@php.net | Date: | Sun, 20 Jul 2008 16:11:25 +0000 |
| Subject: | note 28501 modified in language.variables by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-142161@lists.php.net to get a copy of this message | ||
References are great if you want to point to a variable which you don't quite know the value
yet ;)
eg:
<?php
$error_msg = &$messages['login_error']; // Create a reference
$messages['login_error'] = 'test'; // Then later on set the referenced value
echo $error_msg; // echo the 'referenced value'
?>
The output will be:
test
--was--
References are great if you want to point to a variable which you don't quite know the value
yet ;)
eg:
$error_msg = &$messages['login_error']; // Create a reference
$messages['login_error'] = 'test'; // Then later on set the referenced value
echo $error_msg; // echo the 'referenced value'
The output will be:
test
http://php.net/manual/en/language.variables.php