<!DOCTYPE HTML> <html> <head> <title>PHP: Variable</title> </head> <body> <?php echo "<h1>Hello World!</h1>"; ?> <?php // create an init a varaible $body_temp = 98.6; // display the variable value echo $body_temp; // echo is equivalent to print, not println // display the variable value substituted in a mixed string echo "<p>Body temperature is $body_temp degree Fahrenheit"; // now, assign a new value to the variable $body_temp = 37.0; // display the new variable substitied in a mixed string echo " ( $body_temp degrees Celsius )</p>"; $str1 = "If you are \"happy\" and you 'know' it ... "; // use "escape" character (\) for quote inside qoute $str2 = "clap your hand!"; $str = $str1 . $str2; echo $str."<br />"; print "body_temp is " . $body_temp .'<br/>'; print("body_temp is " . $body_temp .'<br/>'); printf("body_temp is " . $body_temp .'<br/>'); printf("body_temp is %5.3f" , $body_temp , '<br/>'); ?> </body> </html>