bilangan bulat ke string php
return strval($integer);
Awful Anaconda
return strval($integer);
$number = 11;
// This
echo strval($number);
// Or This
echo (String) $number;
// Output
// "11"
// "11"
phpCopy<?php
$variable = 10;
$string1 = (string)$variable;
echo "The variable is converted to a string and its value is $string1.";
?>
phpCopy<?php
$variable = 10;
$string1 = strval($variable);
echo "The variable is converted to a string and its value is $string1.";
?>
<?php
class StrValTest
{
public function __toString()
{
return __CLASS__;
}
}
// Prints 'StrValTest'
echo strval(new StrValTest);
?>
phpCopy$string = (string)$intVariable