PHP Dynamic Variable

dynamic.thumbnail

PHP Dynamic Variable >>
_____________________

$sajith = ‘kenney’ ;

$kenney = 110 ;

echo $$sajith ;
//will give an output 110

Another Example is:

<?php

$fashion1 = ‘fas1′;
$fashion2 = ‘fas2′;
$fashion3 = ‘fas3′;

$fashion = ”;
for($i=1; $i <= 3 ; $i++)
{
$fashion = $fashion. ‘,’ . $ { ‘fashion’ . $i } ;
}

echo $fashion;
//will give an output ,fas1,fas2,fas3

?>

1 Comments

One Response to “PHP Dynamic Variable”

  1. jaya July 20, 2009 at 8:08 pm #

    nice explanation and example thanks

Leave a Reply

More in php (91 of 101 articles)


PHP Simple Swap >> Hello programmers, You know list function in php and array function. Just type like below ...