INTDIV(3) 1 INTDIV(3)intdiv - Integer divisionSYNOPSIS
integer intdiv (integer $numerator, integer $divisor)
DESCRIPTION
Returns the integer division of $numerator by $divisor.
PARAMETERS
o $numerator
- Number to be divide.
o $divisor
- Number which divides the $numerator
RETURN VALUES
The integer division of $numerator by $divisor. If $divisor is zero, it throws an E_WARNING and returns FALSE. If the $numerator is
LONG_MIN (- PHP_INT_MAX - 1) and the $divisor is -1, it returns zero.
EXAMPLES
Example #1
intdiv(3) example
<?php
var_dump(intdiv(3, 2));
var_dump(intdiv(-3, 2));
var_dump(intdiv(3, -2));
var_dump(intdiv(-3, -2));
var_dump(intdiv(PHP_INT_MAX, PHP_INT_MAX));
var_dump(intdiv(-PHP_INT_MAX - 1, -PHP_INT_MAX - 1));
var_dump(intdiv(-PHP_INT_MAX - 1, -1));
var_dump(intdiv(1, 0));
?>
int(1)
int(-1)
int(-1)
int(1)int(1)int(1)int(0)
Warning: intdiv(): Division by zero in %s on line 9
bool(false)
PHP Documentation Group INTDIV(3)
Check Out this Related Man Page
VAR_DUMP(3) 1 VAR_DUMP(3)var_dump - Dumps information about a variableSYNOPSIS
void var_dump (mixed $expression, [mixed $...])
DESCRIPTION
This function displays structured information about one or more expressions that includes its type and value. Arrays and objects are
explored recursively with values indented to show structure.
All public, private and protected properties of objects will be returned in the output unless the object implements a __debugInfo() method
(implemented in PHP 5.6.0).
Tip
As with anything that outputs its result directly to the browser, the output-control functions can be used to capture the output of
this function, and save it in a string (for example).
PARAMETERS
o $expression
- The variable you want to dump.
RETURN VALUES
No value is returned.
EXAMPLES
Example #1
var_dump(3) example
<?php
$a = array(1, 2, array("a", "b", "c"));
var_dump($a);
?>
The above example will output:
array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
array(3) {
[0]=>
string(1) "a"
[1]=>
string(1) "b"
[2]=>
string(1) "c"
}
}
<?php
$b = 3.1;
$c = true;
var_dump($b, $c);
?>
The above example will output:
float(3.1)
bool(true)
SEE ALSO print_r(3), debug_zval_dump(3), var_export(3), __debugInfo().
PHP Documentation Group VAR_DUMP(3)
how can i show the value when i divide a number where the dividend is greater then the divisor. for example...
3 divided by 15 ---> let x=3/15
when i do this in the shell environment it gives me an output of 0.
please help me.
thanks. (3 Replies)
I received error "awk: division by zero" while executing the following statement.
SunOS 5.10 Generic_142900-15 sun4us sparc FJSV,GPUZC-M
echo 8 | awk 'END {printf ("%d\n",NR/$1 + 0.5);}' file1.lst
awk: division by zero
Can someone provide solution?
Thanks
Please use code... (11 Replies)
hello
i try to divide 2 variables in order to get a percentage--that's why i'm not interested in integer division--but nothing seems to work
I think awk is suitable for this but i'm not quite sure how to use it..
any ideas?
here's what I want to do:
percentage = varA/varB
thank you (2 Replies)