Menu Riverview Church

INTVAL

Get the integer value of a variable

SYNTAX

intval ( mixed $var [, int $base = 10 ] ) : int

PARAMETERS

var

The scalar value being converted to an integer

base

The base for the conversion

Note: If base is 0, the base used is determined by the format of var:

if string includes a "0x" (or "0X") prefix, the base is taken as 16 (hex); otherwise,

if string starts with "0", the base is taken as 8 (octal); otherwise,

the base is taken as 10 (decimal).

RETURN

The integer value of var on success, or 0 on failure. Empty arrays return 0, non-empty arrays return 1. The maximum value depends on the system. The maximum signed integer value for 64 bit systems is 9223372036854775807. Strings will most likely return 0 although this depends on the leftmost characters of the string. The common rules of integer casting apply. intval() should not be used on objects, as doing so will emit an E_NOTICE level error and return 1.

EXAMPLES

1

float(0)
int(0)

2

string(1) "0"
int(2)
int(0)

3

NULL
int(0)

bool(false)
int(0)

bool(true)
int(1)

int(-9223372036854775808)
int(-9223372036854775808)

int(9223372036854775807)
int(9223372036854775807)

int(0)
int(0)

int(1)
int(1)

int(23)
int(23)

int(0)
int(0)

int(0)
int(0)

int(-1)
int(-1)

int(1)
int(1)

int(-23)
int(-23)

int(23)
int(23)

int(0)
int(0)

int(1)
int(1)

int(19)
int(19)

int(0)
int(0)

int(1)
int(1)

int(35)
int(35)

float(0)
int(0)

float(1.1)
int(1)

float(23.45)
int(23)

float(0)
int(0)

float(10000000000)
int(10000000000)

float(230000000000)
int(230000000000)

string(0) ""
int(0)

string(1) "0"
int(0)

string(1) "1"
int(1)

string(2) "23"
int(23)

string(2) "-0"
int(0)

string(2) "+0"
int(0)

string(2) "-1"
int(-1)

string(2) "+1"
int(1)

string(3) "-23"
int(-23)

string(3) "+23"
int(23)

string(2) "00"
int(0)

string(2) "01"
int(1)

string(3) "023"
int(23)

string(3) "0x0"
int(0)

string(3) "0x1"
int(0)

string(4) "0x23"
int(0)

string(3) "0.0"
int(0)

string(3) "1.1"
int(1)

string(5) "23.45"
int(23)

string(4) "0e10"
int(0)

string(4) "1e10"
int(10000000000)

string(5) "23e10"
int(230000000000)

string(4) "0abc"
int(0)

string(4) "1abc"
int(1)

string(5) "23abc"
int(23)

string(5) "-0abc"
int(0)

string(5) "+0abc"
int(0)

string(5) "-1abc"
int(-1)

string(5) "+1abc"
int(1)

string(6) "-23abc"
int(-23)

string(6) "+23abc"
int(23)

string(5) "00abc"
int(0)

string(5) "01abc"
int(1)

string(6) "023abc"
int(23)

string(6) "0x0abc"
int(0)

string(6) "0x1abc"
int(0)

string(7) "0x23abc"
int(0)

string(6) "0.0abc"
int(0)

string(6) "1.1abc"
int(1)

string(8) "23.45abc"
int(23)

string(7) "0e10abc"
int(0)

string(7) "1e10abc"
int(10000000000)

string(8) "23e10abc"
int(230000000000)

string(3) "abc"
int(0)

string(4) "abc0"
int(0)

string(4) "abc1"
int(0)

string(5) "abc23"
int(0)

string(5) "abc-0"
int(0)

string(5) "abc+0"
int(0)

string(5) "abc-1"
int(0)

string(5) "abc+1"
int(0)

string(6) "abc-23"
int(0)

string(6) "abc+23"
int(0)

string(5) "abc00"
int(0)

string(5) "abc01"
int(0)

string(6) "abc023"
int(0)

string(6) "abc0x0"
int(0)

string(6) "abc0x1"
int(0)

string(7) "abc0x23"
int(0)

string(6) "abc0.0"
int(0)

string(6) "abc1.1"
int(0)

string(8) "abc23.45"
int(0)

string(7) "abc0e10"
int(0)

string(7) "abc1e10"
int(0)

string(8) "abc23e10"
int(0)

array(0) {
}
int(0)

array(2) {
[0]=>
int(0)
[1]=>
int(1)
}
int(1)

4

NULL
int(2)
int(0)

NULL
int(8)
int(0)

NULL
int(10)
int(0)

NULL
int(16)
int(0)

bool(false)
int(2)
int(0)

bool(false)
int(8)
int(0)

bool(false)
int(10)
int(0)

bool(false)
int(16)
int(0)

bool(true)
int(2)
int(1)

bool(true)
int(8)
int(1)

bool(true)
int(10)
int(1)

bool(true)
int(16)
int(1)

int(-9223372036854775808)
int(2)
int(-9223372036854775808)

int(-9223372036854775808)
int(8)
int(-9223372036854775808)

int(-9223372036854775808)
int(10)
int(-9223372036854775808)

int(-9223372036854775808)
int(16)
int(-9223372036854775808)

int(9223372036854775807)
int(2)
int(9223372036854775807)

int(9223372036854775807)
int(8)
int(9223372036854775807)

int(9223372036854775807)
int(10)
int(9223372036854775807)

int(9223372036854775807)
int(16)
int(9223372036854775807)

int(0)
int(2)
int(0)

int(0)
int(8)
int(0)

int(0)
int(10)
int(0)

int(0)
int(16)
int(0)

int(1)
int(2)
int(1)

int(1)
int(8)
int(1)

int(1)
int(10)
int(1)

int(1)
int(16)
int(1)

int(23)
int(2)
int(23)

int(23)
int(8)
int(23)

int(23)
int(10)
int(23)

int(23)
int(16)
int(23)

int(0)
int(2)
int(0)

int(0)
int(8)
int(0)

int(0)
int(10)
int(0)

int(0)
int(16)
int(0)

int(0)
int(2)
int(0)

int(0)
int(8)
int(0)

int(0)
int(10)
int(0)

int(0)
int(16)
int(0)

int(-1)
int(2)
int(-1)

int(-1)
int(8)
int(-1)

int(-1)
int(10)
int(-1)

int(-1)
int(16)
int(-1)

int(1)
int(2)
int(1)

int(1)
int(8)
int(1)

int(1)
int(10)
int(1)

int(1)
int(16)
int(1)

int(-23)
int(2)
int(-23)

int(-23)
int(8)
int(-23)

int(-23)
int(10)
int(-23)

int(-23)
int(16)
int(-23)

int(23)
int(2)
int(23)

int(23)
int(8)
int(23)

int(23)
int(10)
int(23)

int(23)
int(16)
int(23)

int(0)
int(2)
int(0)

int(0)
int(8)
int(0)

int(0)
int(10)
int(0)

int(0)
int(16)
int(0)

int(1)
int(2)
int(1)

int(1)
int(8)
int(1)

int(1)
int(10)
int(1)

int(1)
int(16)
int(1)

int(19)
int(2)
int(19)

int(19)
int(8)
int(19)

int(19)
int(10)
int(19)

int(19)
int(16)
int(19)

int(0)
int(2)
int(0)

int(0)
int(8)
int(0)

int(0)
int(10)
int(0)

int(0)
int(16)
int(0)

int(1)
int(2)
int(1)

int(1)
int(8)
int(1)

int(1)
int(10)
int(1)

int(1)
int(16)
int(1)

int(35)
int(2)
int(35)

int(35)
int(8)
int(35)

int(35)
int(10)
int(35)

int(35)
int(16)
int(35)

float(0)
int(2)
int(0)

float(0)
int(8)
int(0)

float(0)
int(10)
int(0)

float(0)
int(16)
int(0)

float(1.1)
int(2)
int(1)

float(1.1)
int(8)
int(1)

float(1.1)
int(10)
int(1)

float(1.1)
int(16)
int(1)

float(23.45)
int(2)
int(23)

float(23.45)
int(8)
int(23)

float(23.45)
int(10)
int(23)

float(23.45)
int(16)
int(23)

float(0)
int(2)
int(0)

float(0)
int(8)
int(0)

float(0)
int(10)
int(0)

float(0)
int(16)
int(0)

float(10000000000)
int(2)
int(10000000000)

float(10000000000)
int(8)
int(10000000000)

float(10000000000)
int(10)
int(10000000000)

float(10000000000)
int(16)
int(10000000000)

float(230000000000)
int(2)
int(230000000000)

float(230000000000)
int(8)
int(230000000000)

float(230000000000)
int(10)
int(230000000000)

float(230000000000)
int(16)
int(230000000000)

string(0) ""
int(2)
int(0)

string(0) ""
int(8)
int(0)

string(0) ""
int(10)
int(0)

string(0) ""
int(16)
int(0)

string(1) "0"
int(2)
int(0)

string(1) "0"
int(8)
int(0)

string(1) "0"
int(10)
int(0)

string(1) "0"
int(16)
int(0)

string(1) "1"
int(2)
int(1)

string(1) "1"
int(8)
int(1)

string(1) "1"
int(10)
int(1)

string(1) "1"
int(16)
int(1)

string(2) "23"
int(2)
int(0)

string(2) "23"
int(8)
int(19)

string(2) "23"
int(10)
int(23)

string(2) "23"
int(16)
int(35)

string(2) "-0"
int(2)
int(0)

string(2) "-0"
int(8)
int(0)

string(2) "-0"
int(10)
int(0)

string(2) "-0"
int(16)
int(0)

string(2) "+0"
int(2)
int(0)

string(2) "+0"
int(8)
int(0)

string(2) "+0"
int(10)
int(0)

string(2) "+0"
int(16)
int(0)

string(2) "-1"
int(2)
int(-1)

string(2) "-1"
int(8)
int(-1)

string(2) "-1"
int(10)
int(-1)

string(2) "-1"
int(16)
int(-1)

string(2) "+1"
int(2)
int(1)

string(2) "+1"
int(8)
int(1)

string(2) "+1"
int(10)
int(1)

string(2) "+1"
int(16)
int(1)

string(3) "-23"
int(2)
int(0)

string(3) "-23"
int(8)
int(-19)

string(3) "-23"
int(10)
int(-23)

string(3) "-23"
int(16)
int(-35)

string(3) "+23"
int(2)
int(0)

string(3) "+23"
int(8)
int(19)

string(3) "+23"
int(10)
int(23)

string(3) "+23"
int(16)
int(35)

string(2) "00"
int(2)
int(0)

string(2) "00"
int(8)
int(0)

string(2) "00"
int(10)
int(0)

string(2) "00"
int(16)
int(0)

string(2) "01"
int(2)
int(1)

string(2) "01"
int(8)
int(1)

string(2) "01"
int(10)
int(1)

string(2) "01"
int(16)
int(1)

string(3) "023"
int(2)
int(0)

string(3) "023"
int(8)
int(19)

string(3) "023"
int(10)
int(23)

string(3) "023"
int(16)
int(35)

string(3) "0x0"
int(2)
int(0)

string(3) "0x0"
int(8)
int(0)

string(3) "0x0"
int(10)
int(0)

string(3) "0x0"
int(16)
int(0)

string(3) "0x1"
int(2)
int(0)

string(3) "0x1"
int(8)
int(0)

string(3) "0x1"
int(10)
int(0)

string(3) "0x1"
int(16)
int(1)

string(4) "0x23"
int(2)
int(0)

string(4) "0x23"
int(8)
int(0)

string(4) "0x23"
int(10)
int(0)

string(4) "0x23"
int(16)
int(35)

string(3) "0.0"
int(2)
int(0)

string(3) "0.0"
int(8)
int(0)

string(3) "0.0"
int(10)
int(0)

string(3) "0.0"
int(16)
int(0)

string(3) "1.1"
int(2)
int(1)

string(3) "1.1"
int(8)
int(1)

string(3) "1.1"
int(10)
int(1)

string(3) "1.1"
int(16)
int(1)

string(5) "23.45"
int(2)
int(0)

string(5) "23.45"
int(8)
int(19)

string(5) "23.45"
int(10)
int(23)

string(5) "23.45"
int(16)
int(35)

string(4) "0e10"
int(2)
int(0)

string(4) "0e10"
int(8)
int(0)

string(4) "0e10"
int(10)
int(0)

string(4) "0e10"
int(16)
int(3600)

string(4) "1e10"
int(2)
int(1)

string(4) "1e10"
int(8)
int(1)

string(4) "1e10"
int(10)
int(10000000000)

string(4) "1e10"
int(16)
int(7696)

string(5) "23e10"
int(2)
int(0)

string(5) "23e10"
int(8)
int(19)

string(5) "23e10"
int(10)
int(230000000000)

string(5) "23e10"
int(16)
int(146960)

string(4) "0abc"
int(2)
int(0)

string(4) "0abc"
int(8)
int(0)

string(4) "0abc"
int(10)
int(0)

string(4) "0abc"
int(16)
int(2748)

string(4) "1abc"
int(2)
int(1)

string(4) "1abc"
int(8)
int(1)

string(4) "1abc"
int(10)
int(1)

string(4) "1abc"
int(16)
int(6844)

string(5) "23abc"
int(2)
int(0)

string(5) "23abc"
int(8)
int(19)

string(5) "23abc"
int(10)
int(23)

string(5) "23abc"
int(16)
int(146108)

string(5) "-0abc"
int(2)
int(0)

string(5) "-0abc"
int(8)
int(0)

string(5) "-0abc"
int(10)
int(0)

string(5) "-0abc"
int(16)
int(-2748)

string(5) "+0abc"
int(2)
int(0)

string(5) "+0abc"
int(8)
int(0)

string(5) "+0abc"
int(10)
int(0)

string(5) "+0abc"
int(16)
int(2748)

string(5) "-1abc"
int(2)
int(-1)

string(5) "-1abc"
int(8)
int(-1)

string(5) "-1abc"
int(10)
int(-1)

string(5) "-1abc"
int(16)
int(-6844)

string(5) "+1abc"
int(2)
int(1)

string(5) "+1abc"
int(8)
int(1)

string(5) "+1abc"
int(10)
int(1)

string(5) "+1abc"
int(16)
int(6844)

string(6) "-23abc"
int(2)
int(0)

string(6) "-23abc"
int(8)
int(-19)

string(6) "-23abc"
int(10)
int(-23)

string(6) "-23abc"
int(16)
int(-146108)

string(6) "+23abc"
int(2)
int(0)

string(6) "+23abc"
int(8)
int(19)

string(6) "+23abc"
int(10)
int(23)

string(6) "+23abc"
int(16)
int(146108)

string(5) "00abc"
int(2)
int(0)

string(5) "00abc"
int(8)
int(0)

string(5) "00abc"
int(10)
int(0)

string(5) "00abc"
int(16)
int(2748)

string(5) "01abc"
int(2)
int(1)

string(5) "01abc"
int(8)
int(1)

string(5) "01abc"
int(10)
int(1)

string(5) "01abc"
int(16)
int(6844)

string(6) "023abc"
int(2)
int(0)

string(6) "023abc"
int(8)
int(19)

string(6) "023abc"
int(10)
int(23)

string(6) "023abc"
int(16)
int(146108)

string(6) "0x0abc"
int(2)
int(0)

string(6) "0x0abc"
int(8)
int(0)

string(6) "0x0abc"
int(10)
int(0)

string(6) "0x0abc"
int(16)
int(2748)

string(6) "0x1abc"
int(2)
int(0)

string(6) "0x1abc"
int(8)
int(0)

string(6) "0x1abc"
int(10)
int(0)

string(6) "0x1abc"
int(16)
int(6844)

string(7) "0x23abc"
int(2)
int(0)

string(7) "0x23abc"
int(8)
int(0)

string(7) "0x23abc"
int(10)
int(0)

string(7) "0x23abc"
int(16)
int(146108)

string(6) "0.0abc"
int(2)
int(0)

string(6) "0.0abc"
int(8)
int(0)

string(6) "0.0abc"
int(10)
int(0)

string(6) "0.0abc"
int(16)
int(0)

string(6) "1.1abc"
int(2)
int(1)

string(6) "1.1abc"
int(8)
int(1)

string(6) "1.1abc"
int(10)
int(1)

string(6) "1.1abc"
int(16)
int(1)

string(8) "23.45abc"
int(2)
int(0)

string(8) "23.45abc"
int(8)
int(19)

string(8) "23.45abc"
int(10)
int(23)

string(8) "23.45abc"
int(16)
int(35)

string(7) "0e10abc"
int(2)
int(0)

string(7) "0e10abc"
int(8)
int(0)

string(7) "0e10abc"
int(10)
int(0)

string(7) "0e10abc"
int(16)
int(14748348)

string(7) "1e10abc"
int(2)
int(1)

string(7) "1e10abc"
int(8)
int(1)

string(7) "1e10abc"
int(10)
int(10000000000)

string(7) "1e10abc"
int(16)
int(31525564)

string(8) "23e10abc"
int(2)
int(0)

string(8) "23e10abc"
int(8)
int(19)

string(8) "23e10abc"
int(10)
int(230000000000)

string(8) "23e10abc"
int(16)
int(601950908)

string(3) "abc"
int(2)
int(0)

string(3) "abc"
int(8)
int(0)

string(3) "abc"
int(10)
int(0)

string(3) "abc"
int(16)
int(2748)

string(4) "abc0"
int(2)
int(0)

string(4) "abc0"
int(8)
int(0)

string(4) "abc0"
int(10)
int(0)

string(4) "abc0"
int(16)
int(43968)

string(4) "abc1"
int(2)
int(0)

string(4) "abc1"
int(8)
int(0)

string(4) "abc1"
int(10)
int(0)

string(4) "abc1"
int(16)
int(43969)

string(5) "abc23"
int(2)
int(0)

string(5) "abc23"
int(8)
int(0)

string(5) "abc23"
int(10)
int(0)

string(5) "abc23"
int(16)
int(703523)

string(5) "abc-0"
int(2)
int(0)

string(5) "abc-0"
int(8)
int(0)

string(5) "abc-0"
int(10)
int(0)

string(5) "abc-0"
int(16)
int(2748)

string(5) "abc+0"
int(2)
int(0)

string(5) "abc+0"
int(8)
int(0)

string(5) "abc+0"
int(10)
int(0)

string(5) "abc+0"
int(16)
int(2748)

string(5) "abc-1"
int(2)
int(0)

string(5) "abc-1"
int(8)
int(0)

string(5) "abc-1"
int(10)
int(0)

string(5) "abc-1"
int(16)
int(2748)

string(5) "abc+1"
int(2)
int(0)

string(5) "abc+1"
int(8)
int(0)

string(5) "abc+1"
int(10)
int(0)

string(5) "abc+1"
int(16)
int(2748)

string(6) "abc-23"
int(2)
int(0)

string(6) "abc-23"
int(8)
int(0)

string(6) "abc-23"
int(10)
int(0)

string(6) "abc-23"
int(16)
int(2748)

string(6) "abc+23"
int(2)
int(0)

string(6) "abc+23"
int(8)
int(0)

string(6) "abc+23"
int(10)
int(0)

string(6) "abc+23"
int(16)
int(2748)

string(5) "abc00"
int(2)
int(0)

string(5) "abc00"
int(8)
int(0)

string(5) "abc00"
int(10)
int(0)

string(5) "abc00"
int(16)
int(703488)

string(5) "abc01"
int(2)
int(0)

string(5) "abc01"
int(8)
int(0)

string(5) "abc01"
int(10)
int(0)

string(5) "abc01"
int(16)
int(703489)

string(6) "abc023"
int(2)
int(0)

string(6) "abc023"
int(8)
int(0)

string(6) "abc023"
int(10)
int(0)

string(6) "abc023"
int(16)
int(11255843)

string(6) "abc0x0"
int(2)
int(0)

string(6) "abc0x0"
int(8)
int(0)

string(6) "abc0x0"
int(10)
int(0)

string(6) "abc0x0"
int(16)
int(43968)

string(6) "abc0x1"
int(2)
int(0)

string(6) "abc0x1"
int(8)
int(0)

string(6) "abc0x1"
int(10)
int(0)

string(6) "abc0x1"
int(16)
int(43968)

string(7) "abc0x23"
int(2)
int(0)

string(7) "abc0x23"
int(8)
int(0)

string(7) "abc0x23"
int(10)
int(0)

string(7) "abc0x23"
int(16)
int(43968)

string(6) "abc0.0"
int(2)
int(0)

string(6) "abc0.0"
int(8)
int(0)

string(6) "abc0.0"
int(10)
int(0)

string(6) "abc0.0"
int(16)
int(43968)

string(6) "abc1.1"
int(2)
int(0)

string(6) "abc1.1"
int(8)
int(0)

string(6) "abc1.1"
int(10)
int(0)

string(6) "abc1.1"
int(16)
int(43969)

string(8) "abc23.45"
int(2)
int(0)

string(8) "abc23.45"
int(8)
int(0)

string(8) "abc23.45"
int(10)
int(0)

string(8) "abc23.45"
int(16)
int(703523)

string(7) "abc0e10"
int(2)
int(0)

string(7) "abc0e10"
int(8)
int(0)

string(7) "abc0e10"
int(10)
int(0)

string(7) "abc0e10"
int(16)
int(180096528)

string(7) "abc1e10"
int(2)
int(0)

string(7) "abc1e10"
int(8)
int(0)

string(7) "abc1e10"
int(10)
int(0)

string(7) "abc1e10"
int(16)
int(180100624)

string(8) "abc23e10"
int(2)
int(0)

string(8) "abc23e10"
int(8)
int(0)

string(8) "abc23e10"
int(10)
int(0)

string(8) "abc23e10"
int(16)
int(2881633808)

array(0) {
}
int(2)
int(0)

array(0) {
}
int(8)
int(0)

array(0) {
}
int(10)
int(0)

array(0) {
}
int(16)
int(0)

array(2) {
[0]=>
int(0)
[1]=>
int(1)
}
int(2)
int(1)

array(2) {
[0]=>
int(0)
[1]=>
int(1)
}
int(8)
int(1)

array(2) {
[0]=>
int(0)
[1]=>
int(1)
}
int(10)
int(1)

array(2) {
[0]=>
int(0)
[1]=>
int(1)
}
int(16)
int(1)

INTERNAL

boolval

floatval

strval

EXTERNAL

PHP