KingPin's Forum
 
K.P.s.N. Register vbBux / KPs Mall Bugs Blogs FAQ Search Today's Posts Mark Forums Read Donate
Go Back   KingPin's Forum > KP's Network Forum > Tutorials & Stuff!
Reload this Page PHP Tutorial #1 : Intro to PHP
 


Tutorials & Stuff! This is a discussion on PHP Tutorial #1 : Intro to PHP in the Tutorials & Stuff!;
Description: Introduction: I spend a lot of time in forums, and the question of "Where to start?" arises commonly. So I ...

Reply
 
LinkBack Thread Tools
PHP Tutorial #1 : Intro to PHP
(#1 (permalink))
Old
KingPin's Avatar
KingPin is Offline
Da Boss!
KingPin has disabled reputation
 

My Mood:
 
Posts: 7,034
Thanks: 20
Thanked 17 Times in 15 Posts
Blog Entries: 22
Join Date: Apr 2004
Location: Brooklyn, NY
PHP Tutorial #1 : Intro to PHP - July 10th, 2004

Introduction:
I spend a lot of time in forums, and the question of "Where to start?" arises commonly. So I decided to go off and write one somewhere. My objective is to get you familiar with PHP, without overloading you with unnecessary "techonobabble".

So what are those thingys anyways?
PHP is an "Interpreted" language. This means that PHP is NOT compiled, it is parsed at runtime (the time when the script is run. i.e. user visits the page).

All PHP code is enclosed within "". Functions (text that causes action in the script), are ended by the semicolon (";"). Comments (or escaped text) are as follows:

PHP Code:
#shell style comment
//comment
/* C-style comments */ 
Ok, so what exactly does a PHP page look like?

PHP Code:
<?php
 
="Jaguar XK8";
echo
"<html><head><title>Look!ItsPHP!</title></head>";
echo
"<body>";
echo
"Hi,mynameis,,daremetodrive?";
echo
"</body></html>";
?>
Now lets take a look at this. First, we initialize the PHP interpreter. On the second line, we assign the variable "$name" to the value "Jerome Gagner". This is done by first giving the variable a name.

All variables (with the exception of constants, which you need not to worry about) start with the dollar sign ("$"). After we give the variable a name, we assign it a value, with the Assignment Operator ("="). The value can be enclosed in either double or single quotes. Use double when you want to invoke"Variable Interpolation". This means that if a variable is found in between " and ", the value will be printed. But, if you use single quotes, the values will not be printed, instead, the variable name will be printed.

Example:

PHP Code:
<?php

 
="Iamavariable";

echo
"Textfromvariable:";

//willprint:Textfromvariable:Iamavariable;

echo'Textfromvariable:';

//willprint:Textfromvariable:

?>
Next, we use the echo function. There are many ways to display text in PHP, echo is the most common. We do four lines of the echo statement to demonstrate how PHP can be integrated with HTML. The first line prints the head and title information, the second line starts the body tag, the third line prints the text "Hi, my name is, Jaguar XK8, dare to drive me?", and the fourth line closed the HTML. Finally, we end the script, closing the PHP tag.


Last edited by KingPin; July 16th, 2008 at 20:33..
 
Reply With Quote
Revenue Shared Ads
PHP Tutorial #1 : Intro to PHP
Revenue Shared Ads
Reply

Bookmarks

Tags
php, tutorial, intro

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Rupees Per Thread View: 1.00
Rupees Per Thread: 15.00
Rupees Per Post: 5.00
Forum Jump



These are the 100 most searched terms
Search Cloud
_backup.rc antrix wow antrix wow server autocad 2007 keygen best google gadgets best wow character bt map devil may cry 4 crack enchanting leveling erika bella fuckteam fuckteam 5 georgina lempin gigistar gigistar topless kpsden kpsforum leatherworking guide leveling enchanting mangos custom vendors mangos item id mangos linux mangos server mangos spell id mangos wotlk mature creampie milena velba no rest for the ass object id wow phoenix marie this is sparta vipersdenforums voyage century bot windows activation workaround windows xp lite wotlk alpha private server wotlk private server wotlk server wotlk wiki wow leatherworking guide wow mount locations wow object id wow object id list wow object id's wow object ids wow objects id www.adobeflashplayer www.adobeflashplayer.com www.kpsforum.com xbox 360 mmorpg ... powered by Simple Search Cloud
Powered by vBulletin® Version 3.8.0 Beta 3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
Copyright 2004-2009 KPsN


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82