Type conversions : Data Type Convert : Language Basics PHP Source Code


PHP Source Code » Language Basics » Data Type Convert »

 

Type conversions



<?
$type_examples[0123;   
$type_examples[13.14159;
$type_examples[2"a string";
$type_examples[3"9.990 (begins with number)";
$type_examples[4= array(9,8,7);
   
print("<TABLE><TR>");
print("<TH>Original</<TH>");
print("<TH>(int)</<TH>");
print("<TH>(double)</<TH>");
print("<TH>(string)</<TH>");
print("<TH>(array)</<TH></TR>");
   
for ($index = 0; $index < 5; $index++){
    print("<TR><TD>$type_examples[$index]</TD>");
    $converted_var =
       (int$type_examples[$index];
    print("<TD>$converted_var</TD>");
    $converted_var =
       (double$type_examples[$index];
    print("<TD>$converted_var</TD>");
    $converted_var =
       (string$type_examples[$index];
    print("<TD>$converted_var</TD>");
    $converted_var =
       (array$type_examples[$index];
    print("<TD>$converted_var</TD></TR>");
  }
print("</TABLE>");
?>

           
       



HTML code for linking to this page:

Follow Navioo On Twitter

PHP Source Code

 Navioo Language Basics
» Data Type Convert