PHP: "Hello World"
"Hello world." is the first program most beginning programmers will learn to write in any given language. Here are four examples of the syntax for "Hello world!" in PHP.
$string = "Hello world!";
// You could also use
echo 'Hello world!';
// Or, if you are familiar with C, printf can be used too.
Now, you can see the following output where "Hello World!" is printed 4 times once from each command. Note, that each sentence in php ends with a semi-colon(;). It tells the php interpreter that the command has ended and can be executed.
Notice that all the code in php is enclosed in <?php and ?>. This makes it easier to separate the php code from HTML when emmeded in it. The following example shows how php can be embbed in HTML to print "Hello World"!.
<title> Hello World!</title>
<?php echo "Hello World!";?>