Code: Select all
<?
$var1=12;
$var2="12"; //How can I convert this to int?
if ($var1==$var2)
{
print "It works";
}
?>Moderator: General Moderators
Code: Select all
<?
$var1=12;
$var2="12"; //How can I convert this to int?
if ($var1==$var2)
{
print "It works";
}
?>Code: Select all
<?
$var1=12;
$var2=(int)"12"; //by casting to new type
$var2=intval("12"); //or using a conversion function
if ($var1==$var2)
{
print "It works";
}
?>