Ok to start off with you first have to know how to start a script. To start a
script you must use "<?php" or "<?",
either works just that "<?php" tells you exactly
what type of script this is. Once you know how to open a script you must know
how to close a script or finnish. To finnish a script you need to use "?>".
This basically tells it that you are done with the PHP code of the script.
Lets take a fast recap, so far we know how to open and close a script. are script so far looks like
<?php
?>
or
<?
?>
Ok if you understand so far you should be able to do the next part. The
next part is to make the script speak to you. You have two ways of making this
happen, "echo"or "print".
Lets say you wanted to write "Hello World" on your page, you would either do "echo
'Hello World';" or "print
'Hello World';".
Now that we have that lets take a look at the four script that you have made possible for yourself.
<?php
echo 'Hello World';
?>
or
<?
echo 'Hello World';
?>
or
<?php
print 'Hello World';
?>
or
<?
print 'Hello World';
?>
This allows you to now go out and make your first PHP scripts you should be happy if you understand this and come back for even more complex script later on.
Comments
Did you ever notice that "Hello World" programs serve NO PURPOSE WHATSOEVER?
Just wondering.
<3 Forever
Post a comment
I'm ready for a more complex script now.
Posted by Spenser at September 28, 2008 10:27 AM