Is there a way to cast "1+2"
string into integer value of 3
?
$a = "1+2";
echo (int)$a; // 1
echo ( $a * 1 ); // 1
eval("\$a = \"$a\";");
echo $a; // "1+2"
I tried googling with no success.
Is there a way to cast "1+2"
string into integer value of 3
?
$a = "1+2";
echo (int)$a; // 1
echo ( $a * 1 ); // 1
eval("\$a = \"$a\";");
echo $a; // "1+2"
I tried googling with no success.