Current Location: Home> Function Categories> intval

intval

Get the integer value of the variable
Name:intval
Category:Variable processing
Programming Language:php
One-line Description:Returns the integer value of the variable.

Definition and usage

intval() function returns the integer value of the variable.

Example

Return integer values ​​of different variables:

 <?php
$a = 32 ;
echo intval ( $a ) . "<br>" ;

$b = 3.2 ;
echo intval ( $b ) . "<br>" ;

$c = "32.5" ;
echo intval ( $c ) . "<br>" ;

$d = array ( ) ;
echo intval ( $d ) . "<br>" ;

$e = array ( "red" , "green" , "blue" ) ;
echo intval ( $e ) . "<br>" ;
?>

Try it yourself

grammar

 intval ( variable , base ) ;
parameter describe
variable Required. Specifies the variable to check.
base

Optional. Specifies the cardinality used for the conversion.

Valid only if the variable is a string. The default cardinality is 10.

Similar Functions
Popular Articles