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.. Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
dbo Posted December 8, 2007 Share Posted December 8, 2007 Give this a try. $Numbers = '0$Multiply5'; Quote Link to comment 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 Quote Link to comment 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'; Quote Link to comment 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. Quote Link to comment 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; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.