return strval($integer);
$number = 11;
// This
echo strval($number);
// Or This
echo (String) $number;
// Output
// "11"
// "11"
phpCopy<?php
$variable = 10;
$string1 = strval($variable);
echo "The variable is converted to a string and its value is $string1.";
?>
phpCopy<?php
$variable = 10;
$string1 = (string)$variable;
echo "The variable is converted to a string and its value is $string1.";
?>
strval($variableName);
phpCopy$string = (string)$intVariable
$int = 5;
$int_as_string = (string) $int;
echo $int . ' is a '. gettype($int) . "
";
echo $int_as_string . ' is a ' . gettype($int_as_string) . "
";
phpCopystrval($variableName);
phpCopy<?php
$variable = 10;
$string1 = "".$variable;
echo "$string1";
$string1 = $variable."";
echo "$string1";
?>
phpCopy<?php
$variable = 10;
$string1 = "The variable is converted to a string and its value is ".$variable.".";
echo "$string1";
?>
phpCopy$integer = 5;
echo "The string is $integer";
phpCopy<?php
$variable = 10;
echo "The variable is converted to a string and its value is $variable.";
?>
phpCopy"First string".$variablename."Second string"
$str = (string) $int;
$str = "$int";