PDA

View Full Version : String to integer?



XcanadamanX
08-23-2007, 07:09 PM
is there a string to integer function in PHP?
ive looked on PHP.net but couldnt find any. help plz.

Sumilion
08-23-2007, 08:56 PM
$a = '19';
$b = '35';
$result = ( ((int) $a) + ((int) $b) );

There we go :) (from a site)

XcanadamanX
08-23-2007, 11:32 PM
thanks sum!

Markus
08-25-2007, 05:51 PM
In PHP all variables are variants, so String to Int doesn't exist, every variable is every type ;)

XcanadamanX
08-25-2007, 08:36 PM
really...:stirthepot:

Night
08-28-2007, 04:24 AM
yep, no need to cast =/