The code you have posted is working just fine.
$timesby = 360 / 36;
echo($timesby);
> 10
In PHP, division is done using the / operator, just as you have done above.
题
How do you divide in php ? When I look online it says use a '/' yet this does not work? When I run the same code with a * for multiply it works.
$timesby = 360 / 36;
Why is this? Is there a different symbol?
Thanks
解决方案
The code you have posted is working just fine.
$timesby = 360 / 36;
echo($timesby);
> 10
In PHP, division is done using the / operator, just as you have done above.
其他提示
The code posted is the correct way to do division in PHP. For more information, refer to the PHP.net docs on Arithmetic operators.
<?php
echo 360 / 36; // Prints 10
echo 10 / 5; // Prints 2
echo 10 / 3; // Prints 3.3333333333333