RE: [PHP] $ vs $$

From: Date: Sun, 19 Nov 2000 12:49:23 +0000
Subject: RE: [PHP] $ vs $$
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-26127@lists.php.net to get a copy of this message
> In case anyone needs to see this in action, I have a short function > which utilizes it. > > The reason for this function is to provide search engine friendly > URLs. > > http://www.nirvani.net/software/variables_from_uri.php.asc > One of the most useful appications of this is when you have a results set and want each col of the current row to be assigned to a variable of the name of the Col IE For the following result set +----------+----------+---------------+ | BookId | Author | Title | +----------+----------+---------------+ | 000001 | Rasmus L | PHP Quick Ref | | 000002 | Tobias R | Web App Devl | | 000003 | Jeffrey F| Master Regex | +----------+----------+---------------+ The following would output a HTML table of them. <table><tr><td>Book Id</td><td>Author</td><td> Title</td></tr> <?php while($r = mysql_fetch_array) { while(list($key,$val) = each($r)) { $$key = $val; } ?> <tr> <td><?= $BookId ?></td> <td><?= $author ?></td> <td><?= $title ?></td> </tr> <?php } ?> </table> James

« previous php.general (#26127) next »