Skip to content

Instantly share code, notes, and snippets.

@eimg
Created May 30, 2012 08:46
Show Gist options
  • Save eimg/2834624 to your computer and use it in GitHub Desktop.
Save eimg/2834624 to your computer and use it in GitHub Desktop.
Embedded PHP in HTML document.
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>PHP Template</title>
</head>
<body>
<h1>Countries</h1>
<table>
<tr>
<th>ISO</th>
<th>Country Name</th>
<th>ISO 3</th>
</tr>
<?php
$countries = array(
array('iso'=>'AS', 'name'=>'American Samoa', 'iso3'=>'ASM'),
array('iso'=>'AD', 'name'=>'Andorra', 'iso3'=>'AND'),
array('iso'=>'AO', 'name'=>'Angola', 'iso3'=>'AGO'),
array('iso'=>'AG', 'name'=>'Antigua and Barbuda', 'iso3'=>'ATG'),
array('iso'=>'AR', 'name'=>'Argentina', 'iso3'=>'ARG'),
array('iso'=>'AM', 'name'=>'Armenia', 'iso3'=>'ARM'),
array('iso'=>'AT', 'name'=>'Austria', 'iso3'=>'AUT'),
array('iso'=>'AZ', 'name'=>'Azerbaijan', 'iso3'=>'AZE'),
array('iso'=>'BS', 'name'=>'Bahamas', 'iso3'=>'BHS'),
array('iso'=>'BH', 'name'=>'Bahrain', 'iso3'=>'BHR'),
array('iso'=>'BD', 'name'=>'Bangladesh', 'iso3'=>'BGD'),
array('iso'=>'BB', 'name'=>'Barbados', 'iso3'=>'BRB')
);
foreach($countries as $country) {
echo "<tr>";
echo "<td>{$country['iso']}</td>";
echo "<td>{$country['name']}</td>";
echo "<td>{$country['iso3']}</td>";
echo "</tr>";
}
?>
</table>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment