标题Figure 2-2: Experimenting with Type Conversion
日期:2008-01-22 ?? 作者:semirock ??来源:http://444p.com
文章打印自: PHP学习之家
访问文章完全地址: http://www.444p.com/example/php-function/aid2041-Experimenting-with-Type-Conversion/
头部广告
Figure 2-2: Experimenting with Type Conversion


Figure 2-2


print("Using settype
\n");
$AverageTemperature = "60.5 degrees";
print("String: $AverageTemperature
\n");
settype($AverageTemperature, "double");
print("Double: $AverageTemperature
\n");
settype($AverageTemperature, "integer");
print("Integer: $AverageTemperature
\n");
settype($AverageTemperature, "string");
print("String: $AverageTemperature
\n");
print("
\n");

print("Using strval, intval, ");
print("and doubleval

\n");
$AverageTemperature = "60.5 degrees";
print("String: ");
print(strval($AverageTemperature));
print("
\n");
print("Double: ");
print(doubleval($AverageTemperature));
print("
\n");
print("Integer: ");
print(intval($AverageTemperature));
print("
\n");
print("String: ");
print(strval($AverageTemperature));
?>

责任编辑:semirock