Variable within variable possible?

Posted by JM4 on Stack Overflow See other posts from Stack Overflow or by JM4
Published on 2010-05-18T14:39:58Z Indexed on 2010/05/18 14:51 UTC
Read the original article Hit count: 173

Filed under:
|

I am trying to create a loop statement for some of my code and am wondering how I can put a variable within another variable.

For example:

<?php 
$j=1;
while ($j <= 9): {

$f$jfname = $_SESSION['F$jFirstName'];
$f$jmi = $_SESSION['F$jMI'];
$f$jlname = $_SESSION['F$jLastName'];
}
 $j++; endwhile; 
?>

Where the goal is to have the j variable increase during the loop and change the values as:

$f1fname $f2fname $f3fname

and so on.

Any ideas?

© Stack Overflow or respective owner

Related posts about php

Related posts about variables