Q:

Write a PHP script to convert the value of a PHP variable to string

0

Write a PHP script to convert the value of a PHP variable to string

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

<?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";
}
?>

Sample Output:

They are not same

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now