PHP -Zeichenfolge zu int int
intval($string);
Concerned Chipmunk
intval($string);
<?php
$string = "56";
$int = intval( $string );
echo $int;
?>
phpCopy<?php
$variable = "53";
$integer = intval($variable);
echo "The variable $variable has converted to a number and its value is $integer.";
echo "\n";
$variable = "25.3";
$float = floatval($variable);
echo "The variable $variable has converted to a number and its value is $float.";
?>
// intval() function to convert
// string into integer
echo intval($num), "\n";
s = "123";
echo intval(s); // 123
s = "hello";
echo intval(s); //0
$myintvariable = intval($myvariable);