An simple exercise in learning the basic, common commands of PHP. I carried out this experiment initially for the portfolio section, but will expand onto the entire site, wherever appropriately applicable.
Hey everyone this sentence is written in html in external.php
hey everyone this sentence is writen in php in external.php.17 Sept 2008.
Really simple, follow-the-instructions from w3schools.com to practice writing it myself instead of copy and paste.
Here’s the code. Please link back here if you’re using it.
Place this PHP in the body tag.
echo "Stage 1. Hello World"."<p />";
//You can't read this on the page, not even when you look at the source.
/* You can't read this either
*/
$text="Stage 3. This is a variable-created string.";
$one=4;
$two=5;
echo $text."<br />";
echo $one."x".$two."=".$one*$two."<p />";
// Part 4
function multiply($x,$y){
$product=$x*$y;
return $product;
}
echo "Stage 4. The following statement is done by calling a function and returning the result of the function"."<br />";
echo "6 x 7 = ".multiply(6,7)."<p />";
echo "Stage 5. The following uses the \"include()\" function to include another php file. <br />";
include("external.php");
Place this PHP in external.php.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' ></meta>
<title>Untitled Document</title>
</head>
<body>
<p>Hey everyone this sentence is written in html in external.php</p>
<?php echo "hey everyone this sentence is writen in php in external.php." ?>
</body>
</html>