Link to home
Start Free TrialLog in
Avatar of mvulden
mvulden

asked on

using a variable as a part in another variabele, php.

I would like to make a variable using a piece of text and an already existing variable.

How can I make the variable, for instance, $picture01, out of $number='01' ?

Regards, Maurice van Ulden
ASKER CERTIFIED SOLUTION
Avatar of snoyes_jw
snoyes_jw
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
My proposal:

<?php
 $number = '01';
 ${"picture$number"} = 'My Value';
 echo ${"picture$number"};
?>
Of course, it looks like this might be better suited to an array.
No comment has been added to this question in more than 21 days, so it is now classified as abandoned..
I will leave the following recommendation for this question in the Cleanup topic area:
Accept: snoyes_jw {http:#13791960}

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

Huji
EE Cleanup Volunteer