programming-examples/php/String/PHP script to convert the value of a PHP variable to string.php

13 lines
249 B
PHP
Raw Permalink Normal View History

2019-11-15 12:59:38 +01:00
<?php
$x = 20; // $x is an integer
$str1 = (string)$x; // $str1 is a string now
// Check whether $x and $str1 are equal or not
if ($x === $str1)
{
echo "They are the same"."\n";
}
else
{
echo "They are not same"."\n";
}
?>