Log in

View Full Version : Resolved Variables past the decimal



Demonicman
01-01-2015, 03:49 AM
Ok this might be a stupid question, but is it possible to use a variable in a number with decimals past the decimal point

For example:
$A=1;
$B='5.46'.$A.'742'; \\Or the following
$B='5.46$A742';

Obviously that wont work (At least I dont think it wont, it makes no sense) but you get the general idea of what I am trying to do.

Beverleyh
01-01-2015, 08:17 AM
The last example would need to be
$B = "5.46$A742";which would turn it from an integer (number) into a string - although PHP is loosely typed and whether it's an integer or string is determined by context, so you'd be able to use $B in a mathematical equation.

Your question isn't really clear to me but you can read more about type casting here http://www.phpro.org/tutorials/PHP-Type-Casting.html