Return to Snippet

Revision: 20703
at November 23, 2009 13:36 by chrisaiv


Initial Code
<?php

/*
	How to dynamically cast a variable
*/

$a = 'kevin';
$b = 'mary';
$c = 'joe';
$d = 'larry';
$e = 'audrey';

$students = array('a', 'b', 'c');

foreach( $students as $seat ){
	echo $$seat . "<br />";
}


?>

Initial URL

                                

Initial Description

                                

Initial Title
PHP: Simple Dynamic Variable Example

Initial Tags
php

Initial Language
PHP