Lacrima Castle
HelpSearchMembersCalendar

Welcome Guest ( Log In | Register )

> First PHP lesson: Text
Rosetta
post Dec 30 2005, 06:30 AM
Post #1


Admiral
*****

Group: Flunkies
Posts: 299
Joined: 23-December 05
From: Space Dreadnought "Nonna"
Member No.: 3



Hello, everyone. Sorry i'm late. We're going to start the first lesson with the most basic of basic; outputting text. Before that however, I'll have to tell you some things on how PHP works. PHP code is executed on the server's side, so that means that you can't view the PHP code when you click on "View Source", as it only shows the outputted information from the PHP code.

Open up your favourite text editor, and follow along, please.

Now, to begin any PHP page, we must start with this:

CODE
<?php


That tells the server that there is going to be some PHP code being executed. Again, this MUST be in the PHP file for it to work!

Now that we've got that done, we'll learn how to CLOSE the PHP code.

Make a few blank lines, and then at the last line, type this in:

CODE
?>


That tells the server that the PHP execution will stop at that point. So when using PHP, all the PHP code MUST be within these:

CODE
<?php
?>


Now, to output the text, we will use a simple command named: echo.

In between the start and close PHP things, type this in:

CODE
echo "";


To output the text, put in the text you wanty to output in between the "s.
The purpose of the ; at the end is significant. When programming in PHP, you have to end almost every 'command' with this, since it in a way, tells the server that the 'command' is finished, and to move on to the next one.


Now, for your homework... I want all those who want to participate in this, write a PHP file that outputs one of your favourite quotes or phrases. To save as a PHP file, simply choose Save as type: All Files, and file.php.

Send to me via AIM if possible.

Good luck, and I look forward to seeing your homework!


~~~
Au.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post



Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 10th June 2024 - 04:08 AM