I want to display a fraction in PHP. For that I wrote:
$a = 3;
$b = 2;
$c = \"$a/$b\";
echo $c; // this displays 3/2
but on the other hand I want to multipl
Try change single quotes into double quotes. Of without quotes, depend what you expect. Then try change type of $c.
Example:
$a = 3;
$b = 2;
$c = "$a/$b"; // or $c = $a/$b;
echo $c; // this displays 3/2
// but on the other hand I want to multiply $c by an integer;
echo (float)$c * 2; // this shows me an error