if i have a string "12" how can i change it into integer and therefore can be use in calculation?
thank you.
Hi,
following works for me:
$string = "12"; echo $string+1; //Outputs 13
I hope it helps, firemouse2001
You could also try settype
settype($var, "integer");
you could also use intval() http://www.php.net/manual/en/function.intval.php
firemouse2001
A lot of mucking around - whenever PHP sees a variable or literal in a situation where it expects an integer, it will treat it as an integer.
print "12"+"40";
returns 52