note 51778 deleted from language.variables by nlopess
| From: | nlopess@php.net | Date: | Mon, 11 Apr 2005 14:15:54 +0000 |
| Subject: | note 51778 deleted from language.variables by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-87837@lists.php.net to get a copy of this message | ||
Note Submitter: pilotdoofy at gmail dot com
----
Note that with php you can also use double variables. I don't believe this was stated yet. Here
is how you would go about doing so. They are handy for OOP (Object Oriented Programming) and make it
easier to recall what the variables are used for and what their contents are.
<?php
# declaring double and single variables
$my_variable = 'PHP is neat';
$$my_variable = ' and handy!';
echo $my_variable . $$my_variable;
# this would return 'PHP is neat and handy!'
?>
The use of double variables becomes more adament when you begin creating large projects. Say for
instance someone has a variabled named $message_title for an online webmail system. Well, they could
have the variable $$message_title which could be formatted in some way and they only want to return
the formatted string.