Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

intdiv(3) [php man page]

INTDIV(3)								 1								 INTDIV(3)

intdiv - Integer division

SYNOPSIS
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

IS_FLOAT(3)								 1							       IS_FLOAT(3)

is_float - Finds whether the type of a variable is float

SYNOPSIS
bool is_float (mixed $var) DESCRIPTION
Finds whether the type of the given variable is float. Note To test if a variable is a number or a numeric string (such as form input, which is always a string), you must use is_numeric(3). PARAMETERS
o $var - The variable being evaluated. RETURN VALUES
Returns TRUE if $var is a float, FALSE otherwise. EXAMPLES
Example #1 is_float(3) example <?php if (is_float(27.25)) { echo "is float "; } else { echo "is not float "; } var_dump(is_float('abc')); var_dump(is_float(23)); var_dump(is_float(23.5)); var_dump(is_float(1e7)); //Scientific Notation var_dump(is_float(true)); ?> The above example will output: is float bool(false) bool(false) bool(true) bool(true) bool(false) SEE ALSO
is_bool(3), is_int(3), is_numeric(3), is_string(3), is_array(3), is_object(3). PHP Documentation Group IS_FLOAT(3)
Man Page

3 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

division problem

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)
Discussion started by: inquirer
3 Replies

2. UNIX for Advanced & Expert Users

awk: division by zero

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)
Discussion started by: kumar77
11 Replies

3. Shell Programming and Scripting

variables division with awk

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)
Discussion started by: vlm
2 Replies