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