PDA

View Full Version : Convert String to Integer?


007
03-02-2006, 03:08 PM
Is it possible to convert a strictly numeric string to an integer value?

If so, how do I do it?

Thanks. :)

~007

Reeve of shinra
03-02-2006, 08:00 PM
This should work

$newvar = (int) $var;

filburt1
03-02-2006, 08:07 PM
Or, instead of a typecast, http://www.php.net/intval .

Lack of strict data types in PHP sucks.

007
03-02-2006, 09:50 PM
Thanks guys. I got it to work now. :)