Possible Duplicate:
how to store chechbox value in php
Here is my code:
<input type="checkbox" name="name[]" value="3" />
And this gets passed as:
array(1) { [0]=> string(1) "3" }
But I would rather like it to be integer. Is this possible?
Possible Duplicate:
how to store chechbox value in php
Here is my code:
<input type="checkbox" name="name[]" value="3" />
And this gets passed as:
array(1) { [0]=> string(1) "3" }
But I would rather like it to be integer. Is this possible?
You can cast value as
$string = '3';
$int = (int) $string;
// or
$int = intval($string);
// or check
if(is_numeric($string)) {}
if(ctype_digit($string)) {}
update
php > $string = '10000000000000';
php > var_dump($string);
string(14) "10000000000000"
php > var_dump((int)$string);
int(10000000000000)
php > var_dump(intval($string));
int(10000000000000)