Not 100% sure I can do this.. But I am wondering if it is possible. I want to be able to do something like this ;
$a = 5
$b = mt_rand(125,245);
$c = $a*1.0$a;
So A = 5 ( for an example, it will be different on different criteria, B is then the random number x 1.0 and the variable..
So this example would be $c = $b*1.05
But as the variable A will look at a specific column in a table it isn't always 5. Am I making this way too complex, is there a more simple way to do this?
I would prefer the table variable to NOT be 1.05
for example.. As it would be easier for me to display just 5
you're on the right track,
$a = 5;
$b = mt_rand(125,245);
$c = $b*(float)('1.0'.$a);
make the 1.0
portion a string, concatenate the contents of $a
and then type juggle it back to a float
and it should work how you're expecting.
So there is no casting:
$a = 5;
$b = mt_rand(125,245);
$c = $b * (1 + ($a / 100));