Entry Level PHP Web Application Development/Our First Programs: Hello, World!/HelloUserWorld-Answer

From Wikibooks, open books for an open world
Jump to: navigation, search
<?php
/*
 * Hello, world in PHP
 */

// Send content type to browser
header('Content-Type: text/html; charset=utf-8');

$user_name = 'Jim';
$hello_text = "Hello, {$user_name}, welcome to the world!";
$page_title = "$hello_text (PHP Version)";
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
 <head>
  <title><?php echo $page_title; ?></title>
 </head>
 <body>
  <p>
   <?php echo $hello_text; ?>
  </p>
 </body>
</html>