note 73203 deleted from language.operators.arithmetic by bjori
| From: | bjori@php.net | Date: | Tue, 13 Feb 2007 10:27:24 +0000 |
| Subject: | note 73203 deleted from language.operators.arithmetic by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-123310@lists.php.net to get a copy of this message | ||
Note Submitter: pegas-h at yandex dot ru
Reason: bad code
----
<?php
/**
* Returns the integer of dividing
*
* @param integer $x
* @param integer $y
* @return
* 0 on failture.
* The integer of dividing $x/$y.
*/
function int_of_div ($x, $y)
{
if ($y == 0)
return false;
$div = (string) ($x / $y);
$arr = explode (".", $div);
return (int) $arr[0];
}
if (($out = int_of_div(111, 12)) == false)
echo 'Error dividing by zero.';
else
echo $out;
?>