PHP -Zeichenfolge zu int int
intval($string);
Concerned Chipmunk
intval($string);
$num = intval("10");
$num = floatval("10.1");
$myintvariable = intval($myvariable);
phpCopy<?php
$variable = "10";
$integer = (int)$variable;
echo "The variable $variable has converted to a number and its value is $integer.";
echo "\n";
$variable = "8.1";
$float = (float)$variable;
echo "The variable $variable has converted to a number and its value is $float.";
?>
$str = "10";
$num = (int)$str;
phpCopy<?php
$variable = "45";
settype($variable, "integer");
echo "The variable has converted to a number and its value is $variable.";
?>