Values and Types
Type Conversion
Conversion casts turn text into numbers or values back into text.
Type Conversion
type_conversion.php
<?php
$raw = ;
$value = (int) $raw;
$doubled = $value * 2;
$label = (string) $doubled . " points";
echo "raw=" . $raw . "\n";
echo "doubled=" . $doubled . "\n";
echo $label . "\n";
<?php
$raw = ;
$value = (int) $raw;
$doubled = $value * 2;
$label = (string) $doubled . " points";
echo "raw=" . $raw . "\n";
echo "doubled=" . $doubled . "\n";
echo $label . "\n";
<?php
$raw = ;
$value = (int) $raw;
$doubled = $value * 2;
$label = (string) $doubled . " points";
echo "raw=" . $raw . "\n";
echo "doubled=" . $doubled . "\n";
echo $label . "\n";
integer cast
`(int)` converts numeric text into an integer that arithmetic can use.