HappyPandaFace Posted April 8, 2007 Share Posted April 8, 2007 I want to make it so the name of a variable is changed by '$z' I'm not sure how to do this. Right not I'm trying: [$row + $z] = 1 But it doesn't work. Link to comment https://forums.phpfreaks.com/topic/46096-dynamic-variable-names/ Share on other sites More sharing options...
PC Nerd Posted April 8, 2007 Share Posted April 8, 2007 ok, i have no idea in what your saying...l could you please expand and explain please Link to comment https://forums.phpfreaks.com/topic/46096-dynamic-variable-names/#findComment-223986 Share on other sites More sharing options...
HappyPandaFace Posted April 8, 2007 Author Share Posted April 8, 2007 I can do this in FLASH 8. I want to make it so if: $z = 1; then: [$var + $z] = 1; would write the number '1' to the variable $var1, which is what [$var + $z] is. The variable $var1 would be the same thing as the variable [$var + $z] Link to comment https://forums.phpfreaks.com/topic/46096-dynamic-variable-names/#findComment-223991 Share on other sites More sharing options...
PC Nerd Posted April 8, 2007 Share Posted April 8, 2007 ok, if your saying that the new variable would be called "varz" then ill have to think about it, or if your simply adding the two variables together, and rigging so it always == 1 please let me know Link to comment https://forums.phpfreaks.com/topic/46096-dynamic-variable-names/#findComment-224003 Share on other sites More sharing options...
HaLo2FrEeEk Posted April 8, 2007 Share Posted April 8, 2007 Are you trying to create a new variable named $varz that has a value of 1? if($z == 1){ $varz = 1; } hmmm? Link to comment https://forums.phpfreaks.com/topic/46096-dynamic-variable-names/#findComment-224011 Share on other sites More sharing options...
HappyPandaFace Posted April 8, 2007 Author Share Posted April 8, 2007 No. I want to create the name of a variable and have it have $z at the end of it. like if it was [$var + $z] = 1 and $z = 2 it would be $var2 = 1 I do this with flash all the time. Link to comment https://forums.phpfreaks.com/topic/46096-dynamic-variable-names/#findComment-224045 Share on other sites More sharing options...
HaLo2FrEeEk Posted April 8, 2007 Share Posted April 8, 2007 this is php, not flash, they are two completely different languages. I'm not sure if this is possible in php. Link to comment https://forums.phpfreaks.com/topic/46096-dynamic-variable-names/#findComment-224054 Share on other sites More sharing options...
HappyPandaFace Posted April 8, 2007 Author Share Posted April 8, 2007 Hmmmmm..... That sucks Link to comment https://forums.phpfreaks.com/topic/46096-dynamic-variable-names/#findComment-224066 Share on other sites More sharing options...
HaLo2FrEeEk Posted April 8, 2007 Share Posted April 8, 2007 It does indeed, I would compare flash and php like Iw ould php and javascript, they are completely different, though there are some similarities. Link to comment https://forums.phpfreaks.com/topic/46096-dynamic-variable-names/#findComment-224071 Share on other sites More sharing options...
HappyPandaFace Posted April 8, 2007 Author Share Posted April 8, 2007 So can flash have arrays? Link to comment https://forums.phpfreaks.com/topic/46096-dynamic-variable-names/#findComment-224327 Share on other sites More sharing options...
Barand Posted April 8, 2007 Share Posted April 8, 2007 <?php $z = 1; $varname = 'var'.$z; $$varname = 4; echo $var1; //--> 4 ?> Link to comment https://forums.phpfreaks.com/topic/46096-dynamic-variable-names/#findComment-224414 Share on other sites More sharing options...
HappyPandaFace Posted April 8, 2007 Author Share Posted April 8, 2007 Thanks. Link to comment https://forums.phpfreaks.com/topic/46096-dynamic-variable-names/#findComment-224416 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.