Tuesday, October 11, 2011

Variables, Data Types and Casting in PHP

Code Example 

<html>
  <body>

<?php
  $num1=25;
  $num2=24;
  echo 'sum of '.$num1.', '.$num2.' : '.($num1+$num2);
   
  $num2=' hello'.$num2;
  echo 'sum of '.$num1.', '.$num2.' : '.($num1+$num2);
  $num3=24;
  $num3=$num3.'hello';
  echo 'sum of '.$num1.' and '.$num3.' : '.($num1+$num3).' note here second data is string ';
?>

  </body>
</html>

No comments:

Post a Comment