xxxxxxxxxx
$number = 11;
// This
echo strval($number);
// Or This
echo (String) $number;
// Output
// "11"
// "11"
xxxxxxxxxx
phpCopy<?php
$variable = 10;
$string1 = strval($variable);
echo "The variable is converted to a string and its value is $string1.";
?>
xxxxxxxxxx
$number = 1234; // The number to convert
$string = strval($number); // Convert the number to a string
echo $string; // Output the converted string
xxxxxxxxxx
phpCopy<?php
$variable = 10;
$string1 = (string)$variable;
echo "The variable is converted to a string and its value is $string1.";
?>
xxxxxxxxxx
$int = 5;
$int_as_string = (string) $int;
echo $int . ' is a '. gettype($int) . "\n";
echo $int_as_string . ' is a ' . gettype($int_as_string) . "\n";
xxxxxxxxxx
$intNumber = 123; // Example integer
$strNumber = strval($intNumber);
echo "Integer converted to string: " . $strNumber;