thefollower Posted December 8, 2007 Share Posted December 8, 2007 I am trying to add a variable to my string but it won't work because of the format i have. This is what i got: $Multiply = 0000; $Numbers = '0.';<?=$Multiply?>'5'; Echo $Numbers should then show: 0.00005 How ever my syntax is wrong but i am unsure how do it.. the decimal dot i think is causing the problem.. I have short tags on.. Link to comment https://forums.phpfreaks.com/topic/80787-assigning-variable-to-variable-problem/ Share on other sites More sharing options...
revraz Posted December 8, 2007 Share Posted December 8, 2007 You have a semi colon in the middle you need to remove. That for sure would stop it, but not sure if it will do what you expect. Link to comment https://forums.phpfreaks.com/topic/80787-assigning-variable-to-variable-problem/#findComment-409768 Share on other sites More sharing options...
dbo Posted December 8, 2007 Share Posted December 8, 2007 Give this a try. $Numbers = '0$Multiply5'; Link to comment https://forums.phpfreaks.com/topic/80787-assigning-variable-to-variable-problem/#findComment-409770 Share on other sites More sharing options...
thefollower Posted December 8, 2007 Author Share Posted December 8, 2007 Give this a try. $Numbers = '0$Multiply5'; that just creates 000005 which isn't correct. I have a text field in my database which has "0000" which then is inputted to create the decimal place position Link to comment https://forums.phpfreaks.com/topic/80787-assigning-variable-to-variable-problem/#findComment-409772 Share on other sites More sharing options...
dbo Posted December 8, 2007 Share Posted December 8, 2007 Yeah I removed the . so put that back in and it will work. $Numbers = '0.$Multiply5'; Link to comment https://forums.phpfreaks.com/topic/80787-assigning-variable-to-variable-problem/#findComment-409774 Share on other sites More sharing options...
revraz Posted December 8, 2007 Share Posted December 8, 2007 Actually, if you use single quotes, then it would echo 0.$Multiply5. Use double quotes to parse the variable. Link to comment https://forums.phpfreaks.com/topic/80787-assigning-variable-to-variable-problem/#findComment-409777 Share on other sites More sharing options...
dbo Posted December 8, 2007 Share Posted December 8, 2007 $Multiply= "0000"; $Numbers = "0." . $Multiply . "5"; echo $Numbers; Link to comment https://forums.phpfreaks.com/topic/80787-assigning-variable-to-variable-problem/#findComment-409780 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.