The Only Acronym You’ll Ever Need
The Right Environment
Start Me Up
A Case of Identity
An Equal Music
Not My Type
Market Value
Stringing Things Along
The Only Acronym You’ll Ever Need
If you’re new to Web development, you could be forgiven for thinking that it
consists of no more than a mass of acronyms, each one more indecipherable than
the last. ASP, CGI, SOAP, XML, HTTP – the list seems never-ending, and
the sheer volume of information on each of these can discourage the most avid
programmer. But before you put on your running shoes and flee, there’s a little
secret you should know. To put together a cutting-edge Web site, chock full of
all the latest bells and whistles, there’s only one acronym you really
need to know:
PHP
Now, while you have almost certainly heard of PHP, you may not be
aware of just how powerful the language is, and how much it can do for you.
Today, PHP has the enviable position of being the only open-source server-side
scripting language that’s both fun and easy to learn. This is not just
advertising: recent surveys show that more than 16,000,000 Web sites use PHP
as a server side scripting language, and the language also tops the list of
most popular Apache modules.
Why, you ask? The short answer: it’s powerful, it’s easy to use, and
it’s free. Extremely robust and scalable, PHP can be used for the most
demanding of applications, and delivers excellent performance even at
high loads. Built-in database support means that you can begin creating
data-driven applications immediately, XML support makes it suitable for
the new generation of XML-enabled applications, and the extensible architecture
makes it easy for developers to use it as a framework to build their own
custom modules. Toss in a great manual, a knowledgeable developer community
and a really low price (can you spell f-r-e-e?) and you’ve got the makings
of a winner!
My goal in this series of tutorials is very simple: I’ll be
teaching you the basics of using PHP, and showing you why I think it’s
the best possible tool for Web application development today.
I’ll be making no assumptions about your level of knowledge,
other than that you can understand basic HTML and have a sense of
humor. And before you ask… Yes, this series covers both PHP 4 and
PHP 5, with new PHP 5 features flagged for easy reference.
Let’s get going!
The Right Environment
PHP is typically used in combination with a Web server like Apache.
Requests for PHP scripts are received by the Web server, and are handled
by the PHP interpreter. The results obtained after execution are returned
to the Web server, which takes care of transmitting them to the client
browser. Within the PHP script itself, the sky’s the limit – your
script can perform calculations, process user input, interact with a
database, read and write files… Basically, anything you can do with a
regular programming language, you can do inside your PHP scripts.
From the above, it is clear that in order to begin using PHP, you
need to have a proper development environment set up.
This series will focus on using PHP with the Apache Web server on
Linux, but you can just as easily use PHP with Apache on Windows, UNIX
and Mac OS. Detailed instructions on how to set up this development
environment on each platform are available in the online manual, at
http://www.php.net/manual/en/installation.php – or you can just download a copy of PHP 5 from
http://www.php.net and read the
installation instructions.
Go do that now, and come back when you’ve successfully installed and tested PHP.
Start Me Up
There’s one essential concept that you need to get your mind around
before we proceed further. Unlike CGI scripts, which require you to
write code to output HTML, PHP lets you embed PHP code in regular HTML
pages, and execute the embedded PHP code when the page is requested.
These embedded PHP commands are enclosed within special start and
end tags, like this:
<?php
... PHP code ...
?>
Here’s a simple example that demonstrates how PHP and HTML can be
combined:
<html>
<head></head>
<body>
Agent: So who do you think you are, anyhow?
<br />
<?php
// print output
echo 'Neo: I am Neo, but my people call me The One.';
?>
</body>
</html>
Not quite your traditional “Hello, World” program… but then
again, I always thought tradition was over-rated.
Save the above script to a location under your Web server document root, with a
.php extension, and browse to it. You’ll see something like this:
Look at the HTML source:
<html>
<head></head>
<body>
Agent: So who do you think you are, anyhow?
<br />
Neo: I am Neo, but my people call me The One.
</body>
</html>
What just happened? When you requested the script above, Apache intercepted
your request and handed it off to PHP. PHP then parsed the script,
executing the code between the <?php...?> marks and
replacing it with the output of the code run. The result was then handed
back to the server and transmitted to the client. Since the output contained
valid HTML, the browser was able to render it for display to the user.
A close look at the script will reveal the basic syntactical rules of PHP.
Every PHP statement ends in a semi-colon. This convention is identical to
that used in Perl, and omitting the semi-colon is one of the most common
mistakes newbies make. That said, it is interesting to note that a semi-colon
is not needed to terminate the last line of a PHP block. The
PHP closing tag includes a semi-colon, therefore the following is perfectly
valid PHP code:
<?php
// print output
echo 'Neo: I am Neo, but my people call me The One.'
?>
It’s also possible to add comments to your PHP code, as I’ve done in
the example above. PHP supports both single-line and multi-line comment
blocks:
<?php
// this is a single-line comment
/* and this is a
multi-line
comment */
?>
Blank lines within the PHP tags are ignored by the parser.
Everything outside the tags is also ignored by the parser, and returned
as-is. Only the code between the tags is read and executed.
A Case of Identity
Variables are the bread and butter of every programming language…
and PHP has them too. A variable can be
thought of as a programming construct used to store both numeric and
non-numeric data; the contents of a variable can be altered during
program execution. Finally, variables can be compared with each other,
and you – the programmer – can write code that performs
specific actions on the basis of this comparison.
PHP supports a number of different variable types: integers, floating
point numbers, strings and arrays. In many languages, it’s essential to
specify the variable type before using it: for example, a variable may
need to be specified as type integer or type array.
Give PHP credit for a little intelligence, though: it automagically
determines variable type by the context in which it is being used!
Every variable has a name. In PHP, a variable name is preceded by a
dollar ($) symbol and must begin with a letter or underscore, optionally
followed by more letters, numbers and/or underscores. For example, $popeye, $one and $INCOME are all valid PHP variable names, while $123 and $48hrs are invalid.
Note that variable names in PHP are case sensitive, so $me is
different from $Me or $ME.
Here’s a simple example that demonstrates PHP’s variables:
<html>
<head></head>
<body>
Agent: So who do you think you are, anyhow?
<br />
<?php
// define variables
$name = 'Neo';
$rank = 'Anomaly';
$serialNumber = 1;
// print output
echo "Neo: I am <b>$name</b>, the <b>$rank</b>. You can call me by my serial number, <b>$serialNumber</b>.";
?>
</body>
</html>
Here, the variables $name, $rank and
$serialNumber are first defined with string and numeric
values, and then substituted in the echo() function call.
The echo() function, along with the print() function,
is commonly used to print data to the standard output device (here, the
browser). Notice that I’ve included HTML tags within the call to echo(),
and those have been rendered by the browser in its output. You can do this too. Really.
An Equal Music
To assign a value to a variable, you use the assignment
operator: the = symbol. This is used to assign a value
(the right side of the equation) to a variable (the left side). The
value being assigned need not always be fixed; it could also be another
variable, an expression, or even an expression involving other
variables, as below:
<?php
$age = $dob + 15;
?>
Interestingly, you can also perform more than one assignment at a
time. Consider the following example, which assigns three variables the
same value simultaneously:
<?php
$angle1 = $angle2 = $angle3 = 60;
?>
Not My Type
Every language has different types of variable – and PHP is no
exception. The language supports a wide variety of data types,
including simple numeric, character, string and Boolean types, and more
complex arrays and objects. Here’s a quick list of the basic ones, with
examples:
- Boolean: The simplest variable type in PHP, a Boolean
variable, simply specifies a true or false value.<?php
$auth = true;
?>
- Integer: An integer is a plain-vanilla whole number like 75, -95, 2000 or 1.
<?php
$age = 99;
?>
- Floating-point: A floating-point number is typically a fractional
number such as 12.5 or 3.141592653589. Floating point numbers may be
specified using either decimal or scientific notation.<?php
$temperature = 56.89;
?>
- String: A string is a sequence of characters, like “hello” or
“abracadabra”. String values may be enclosed in either double quotes
(“”) or single quotes(”). (Quotation marks within the string itself can
be “escaped” with a backslash (\) character.) String values enclosed in
double quotes are automatically parsed for special characters and variable
names; if these are found, they are replaced with the appropriate value.
Here’s an example:<?php
$identity = 'James Bond';
$car = 'BMW';// this would contain the string "James Bond drives a BMW"
$sentence = "$identity drives a $car";
echo $sentence;?>
To learn more about PHP’s data types, visit
http://www.php.net/manual/en/language.types.php.
Market Value
If variables are the building blocks of a programming language,
operators are the glue that let you build something useful with
them. You’ve already seen one example of an operator – the
assignment operator -, which lets you assign a value to a
variable. Since PHP believes in spoiling you, it also comes with
operators for arithmetic, string, comparison and logical operations.
A good way to get familiar with operators is to use them to perform
arithmetic operations on variables, as in the following example:
<html>
<head>
</head>
<body>
<?php
// set quantity
$quantity = 1000;
// set original and current unit price
$origPrice = 100;
$currPrice = 25;
// calculate difference in price
$diffPrice = $currPrice - $origPrice;
// calculate percentage change in price
$diffPricePercent = (($currPrice - $origPrice) * 100)/$origPrice
?>
<table border="1" cellpadding="5" cellspacing="0">
<tr>
<td>Quantity</td>
<td>Cost price</td>
<td>Current price</td>
<td>Absolute change in price</td>
<td>Percent change in price</td>
</tr>
<tr>
<td><?php echo $quantity ?></td>
<td><?php echo $origPrice ?></td>
<td><?php echo $currPrice ?></td>
<td><?php echo $diffPrice ?></td>
<td><?php echo $diffPricePercent ?>%</td>
</tr>
</table>
</body>
</html>
Looks complex? Don’t be afraid – it’s actually pretty simple. The
meat of the script is at the top, where I’ve set up variables for the
unit cost and the quantity. Next, I’ve performed a bunch of calculations
using PHP’s various mathematical operators, and stored the results of
those calculations in different variables. The rest of the script is
related to the display of the resulting calculations in a neat table.
If you’d like, you can even perform an arithmetic operation
simultaneously with an assignment, by using the two operators together.
The two code snippets below are equivalent:
<?php
// this...
$a = 5;
$a = $a + 10;
// ... is the same as this
$a = 5;
$a += 10;
?>
If you don’t believe me, try echoing them both.
Stringing Things Along
Why stop with numbers? PHP also allows you to add strings with the string
concatenation operator, represented by a period (.). Take a look:
<?php
// set up some string variables
$a = 'the';
$b = 'games';
$c = 'begin';
$d = 'now';
// combine them using the concatenation operator
// this returns 'the games begin now<br />'
$statement = $a.' '.$b.' '.$c.' '.$d.'<br />';
print $statement;
// and this returns 'begin the games now!'
$command = $c.' '.$a.' '.$b.' '.$d.'!';
print $command;
?>
As before, you can concatenate and assign simultaneously, as
below:
<?php
// define string
$str = 'the';
// add and assign
$str .= 'n';
// str now contains "then"
echo $str;
?>
To learn more about PHP’s arithmetic and string operators, visit
http://www.php.net/manual/en/language.operators.arithmetic.php
and http://www.php.net/manual/en/language.operators.string.php.
That’s about it for this tutorial. You now know all about the basic
building blocks and glue of PHP – its variables and operators. In
Part Two of this series, I’ll be using these
fundamental concepts to demonstrate PHP’s powerful form processing capabilities.
Copyright Melonfire, 2004 (http://www.melonfire.com).
All rights reserved.




August 4, 2006 at 8:09 am
Is there any data structure like C++ data structures or other programming languages?
( I means a thing like linkedlisr, tree, …)
August 16, 2006 at 2:20 pm
I really appreciate the work you’ve done on these tutorials. It should be very helpful. =)
August 29, 2006 at 5:11 am
This is the first time I use the php. I afriad to that before used this. Now I settle to learn php.
September 10, 2006 at 2:29 pm
Hello,
I am happy that found your tutorials to learn php
Maybe I will learn something because I always wanted. Today I have read your first lesson,
it would be good to have here some practical exercises…..
You wrote about php installation
I have installed XAMPP
What you think about it?
Beata
September 11, 2006 at 6:59 pm
Very good tutorial. I just don’t understand where to put the periods for the string concatenation operator. I mean, what are the rules for when and when not to use them? Is there a FAQ somewhere that would answer this question?
September 19, 2006 at 8:50 am
Well thought out, interesting & very very useful. THANK YOU!
September 19, 2006 at 6:03 pm
It realy more helpful for me
September 20, 2006 at 12:10 pm
i have only one word word : "BRILLIANT"
September 21, 2006 at 2:15 am
Hi I am new to PHP coding. As a beginner i feel u have done a nice piece of work.Keep it up!
October 6, 2006 at 7:12 am
Hello,i’m a begginner,the tutorial is quite helpful and interesting.
Thanks
October 16, 2006 at 4:54 am
I am new to computer, I read this tutorial. Theres enough funny and entertaining to sustain my attention, but I don’t understand it. Why are we doing this. What does this do. What the hell is a server.
I say this guide need more ‘explanation’.
October 16, 2006 at 9:51 am
Thanks, an excellent tut, much appreciated.
October 25, 2006 at 11:52 pm
Freakin amazing…wish my uni lecturers were as entertaining as you!
November 3, 2006 at 10:42 am
Hi,
I love your tutorials on PHP, very good, especially the one on the Apache install. I have gone down the rabbit hole a little farther than on these first pages, but I do have a couple of very simple questions. When considering search engine optimization, I use my navigation to increase my "organic" SEO. If I have my navigation set up as an include on each page, even the index, will I still get the same optimization? Also, is it good practice to make all of your pages have the PHP extension, even if they mostly consist of HTML? How about the index page, should that be HTML or can it also be PHP.
Thanks again!
Sotabound, Burnsville, MN
November 23, 2006 at 11:33 pm
Thank a lot!
It’s very usefull to me as i am new in PHP & MySQL
November 30, 2006 at 8:14 am
This is a nice tutorial, and it helped me out. I was trying to make a calculator and I could get the echo string correct but this helped me. It turns out, it was a lot less complex than what I had anticipated.
December 12, 2006 at 7:03 am
first let me congratulate for the greate efford u took to present such an excellent tutorial on php.Its very easy to digest even as a beginner.
December 12, 2006 at 10:18 am
first let me congratulate for the greate efford u took to present such an excellent tutorial on php.Its very easy to digest even as a beginner.
December 12, 2006 at 12:27 pm
Well written and easy to digest. Great job.
December 12, 2006 at 2:08 pm
I’m a newbee in php and this tutorial is grate.
10x
alio.ro
February 27, 2007 at 7:33 pm
Vikram, not only do you have the same name than my favourite author Vikram Seth, but also is this the first Tutorial I don’t feel intimidated by. Thanks for boosting my motivation to learn PHP….
April 2, 2007 at 1:59 pm
My first class was great. I was initially afraid of PHP but you in your wisdom the solution to my fears looks like its only a few other lessons ahead.
I tried to register in vain. Where do I enter this Zip code, i hail from Nairobi City, Kenya – East Africa
April 27, 2007 at 9:00 pm
When I first looked at a PHP script, I was like, no way thats too complicated. You make PHP sooooo simple. Thanks a lot for these tutorials.
May 17, 2007 at 1:21 pm
Am new to the php scene, have read many articles and tutorials, thou i come back to this site every time, thanks for all the informative and intriging ways of understanding php. it makes understanding this language easier.
May 17, 2007 at 1:23 pm
Am new to the php scene, have read many articles and tutorials, thou i come back to this site every time, thanks for all the informative and intriging ways of understanding php. it makes understanding this language easier.
June 28, 2007 at 9:23 am
As a complete novice trudging thru the mine fields of languages to use for developers, I have found php was the one to actually, FINALLY, be able to teach me how programming works!! I had read about C, C++, java, Javascript, ASP and ASP.NET, VB,… and more, but never really understood the full meanings of things. Now, after learning a little about php, I can look at almost ANY language, and pretty much understand what’s going on! Thanx Guys, and especially the writers of the tutorials. Nd believe it or not, it actually gets easier!!
Joosey.
July 1, 2007 at 11:15 pm
Very useful tutorials, thanks a lot. Hope some day , you could write one specifically for the object oriented capabilities of PHP.
July 8, 2007 at 11:11 pm
I always wanted to learn PHP, but been afraid, that it is too complicated.
I do know little bit about programming, such as Visual Basic.
After this tutorial I feel much comfortable to learn PHP, since its not
very different from other programing languages.
Thank you for the tutorial
August 13, 2007 at 8:16 am
$car = ‘BMW’;
is (very) deprecated
$car = ‘Aston Martin’;
September 18, 2007 at 6:26 pm
This is a superbly, extremely easy to understand article. Thanks for helping out!
September 18, 2007 at 6:27 pm
This is a superbly written, extremely easy to understand article. Thanks for helping out!
October 21, 2007 at 1:51 pm
This is the first php tutorial that I’ve read that I actually understood. Other tutorials freak you out by giving you code excerpts that beginners, unless they are programming geniuses, could not possibly understand.
I find it comforting that php’s basics are similar to C programming which I have just learned in school.
Thank you again.
December 7, 2007 at 5:20 am
Not so much impressive
December 24, 2007 at 6:24 am
To the user who asked what a server is:
Communication involves transmitting and receiving information. In the World Wide Web environment, this is achieved by SERVERS and CLIENTS.
The computer used to browse the Web is the CLIENT. When you visit a Web site, you are making a request for that site to communicate with your CLIENT. The files that you receive in response to your request are <i>served</i> to you from a computer that can be located practically anywhere.
As you might have guessed, Web pages (and other resources like music and video files) are stored on computers called SERVERS.
This article pointed out that PHP is a server-side scripting language. This means that PHP code is processed on the SERVER before the result is sent to the CLIENT (the CLIENT won’t interact with your source code). While JavaScript source code, for instance, usually is sent to the CLIENT and is processed using the CLIENT computer’s resources.
In case you’re wondering, just as a human with normal capabilities can both ask and respond, a single computer can act as both a CLIENT and a SERVER. In essence, such a computer is talking to itself. You already have the CLIENT software (your browser) and, if you decide to learn PHP, you should install SERVER software on your computer so you can test your PHP scripts without having to upload them to a remote SERVER. You can download and use the Apache Server software for free.
Lastly, when writing PHP scripts, it helps to use software that displays each type of PHP element in a different color. Try downloading and installing PHP Coder Pro or PSPad. Both are free applications that can be downloaded.
December 27, 2007 at 10:21 am
As I am freasher in this field ,it is very useful to me. once again thanks.
December 30, 2007 at 7:06 pm
Wow….finally….php made interesting, easy AND fun to study!
Keep up the brilliant work!
January 16, 2008 at 9:28 pm
It’s amazing! Very helpful! Thank you for the great tutorial.
January 19, 2008 at 2:21 pm
I give you 9/10! Why? It’s one of the probably most friendliest PHP tutorial site i’ve been to in as much as others (tutorials) are so boring in the sense that some are to make it simple, maybe they thought of simplicity can be easily understood yet they are only lazy just to say they have a tutorial webiste, and some are so freaking complicated, they punch you with those hardcore combined ascii codes that they used to communicate with aliens. It’s not that i’m into spoon feeding though, but your tutorial explains on every bit of the puzzle that you are tackling in the sense that every normal human being understood.
Thanks and more power!
February 7, 2008 at 6:03 am
thanks for the php tutorial.. this is a big help for us, for begginer…godbless
February 11, 2008 at 6:56 pm
I’ve read many beginning intro to PHP and they all start of with programming
Hello World.
However, "Neo: I am Neo, but my people call me The One." is no different.
My question is when is this ever used?
If the output is going to be "Hello World" why not just write that in the body?
February 27, 2008 at 7:52 am
A user asks why one doesn’t just write the item itself instead of using a variable to name it. Well, the idea is to use a variable as shorthand. "$Name" is certainly shorter than Jonathan Woodgate and a heckuva lot shorter than Rupert Herbert Flauntelroy III. For example. That said, "Hello World" – or the version here, "I’m Neo-Con but my friends call me The Jerk." [or whatever it was
], is a bit over-the-top nerdy.
March 15, 2008 at 11:16 pm
A nice tutorial, but I am having a basic problem — the php output doesn’t seem to want to display. ma using latest version of Firefox, and I have many other php based pages that will show properly in my browser. Even the basic "They call me Neo" isn’t displaying. Firefox is set as program for filetype .php.
So I’m confused.
March 17, 2008 at 7:29 am
Hi all
What is the PHP editor you recommend
especially a free one
March 25, 2008 at 12:42 am
Very well written easy to understand article. I look forward to reading through the rest of them especially as I myself am just venturing through the world of PHP.
March 27, 2008 at 10:08 am
The reason the php is not working for you is probably because you don’t have php properly installed on the server that you are running the php script on. Or you actually don’t have a server set up at all. Simply creating a .php file and then associating it with your browser will not do the job. When you say your browser works with lots of other .php files I bet you mean ones you open from from other websites. Those sites are runniing on servers set up to work with php. The .php file you have written needs to be processed (interpreted) to generate the results you expect. Try making a text file (in notepad or whatever) in the text file just put this one line <?php phpinfo(); ?> Save that file as phpinfo.php Now try to open this file in your browser, if it works you get a lot of info about the PHP version installed on your server. If not you need to find some tutorial on how to install Apache (this is a server) PHP and mySQL on your local PC and get them all working together before you can proceed. I did it the hard way (manually) and it took me some time (i.e. days!) to get it all working. I understand for windows PC’s there is something called XXAMP which is a self installing integrated Apache/PHP/MySQL setup that is easier to get working. However if you do it the hard way you will surely have learned more LOL. Hope this helps, and good luck. Rich.
March 31, 2008 at 12:56 am
THIS TUTORIAL IS REALLY GREAT… it’s easy to understand…
Good Job!
But i have a simple question?
(i think this one maybe a foolish one but….)
what’s the difference in a single quote (”) and double quote (" ")….
i mean is there any problem if i write:
example1.a : echo ‘My name is Neo, they also called me the one!’;
example1.b : echo "My name is Neo, they also called me the one!";
also:
example2.a: $_POST['age'];
example2.b: $_POST["age"]; (why i could’nt use this one if the above example could be possibly use?)
what i want is a clear definitions about (”) and (" ")
April 15, 2008 at 4:30 am
Good question, I went back and played with this. (I’m just learning myself).
Basically, if you enclosed your data between double quotes
echo "data….data",
then php will check to see if there are any variables or special characters between the two " ". If there were none you could equally write
echo ‘data…..data’.
However if there was another variable or special character in there it would not work.
Example as in the tutorial above:-
$identity = ‘James Bond’;
$car = ‘BMW’;
// this would contain the string "James Bond drives a BMW"
$sentence = "$identity drives a $car"; <– double quotes ""
echo $sentence;
output = James Bond drives a BMW
However changing line 4 to
$sentence = ‘$identity drives a $car’; <– Note single quotes ‘ ‘
echo $sentence;
output = $identity drives a $car
Neat huh ?
Great tutorial btw, just going to start the second one at 05:30 in the morning !
April 17, 2008 at 5:42 am
Since someone helped me on my Website, PHP has been a long desire to learn. With no programming knowledge at all, I found this tutorial easier to digest than any other I have come across. I just marveled at how pages were built on my site with PHP and changes to things like menus, images, and content were much faster than having to change each page. Also PHP solved many Cross Browser interpretations of my coding.
May 1, 2008 at 5:21 am
Up above me i see obviously someone new to php and i am not saying what you are saying is wrong but i am putting forward a more clearer guide to the difference between " and ‘ when outputting a string of text using both variables and just plain text.
So lets start
The main difference between "" and ” is the speed in which they output.
This really dosen’t make much difference for high end internet users, but don’t forget alot of people are still on dial up connection.
Using ” is a much faster way of outputting text to the user of your site compared to "".
So let me show you how to use ” properley in conjuction with variables.
Ok so lets say we have the variable $text and it contains ‘Hello’
So it would be wrote as:
$text = ‘Hello’;
Now we want to output this variable into a string of text which we will write after the echo command. How do we do this without making the variable appear ?. Simple.
To make a variable appear you simply write your echo command as shown below:
Echo’This variable contains ‘.$text.’ and will output the text within the variable and not the variable name.’;
This will then output :
‘This variable contains Hello and will output the text within the variable and no the variable name.’
Hope this clears up some confusion with "" and ” and not cause more confusion within the ways they are used.
June 7, 2008 at 6:47 am
Unfortunately, the comments made by sogekishu are not entirely correct. The primary difference between single quotes and double quotes is not their speed. Double quotes may in theory take longer to process then single quotes however this would be a difference determined by the power of the server, not the speed of the user’s internet connection.
The actual difference between single quotes and double quotes (as stated by BobWright) is in the way PHP processes them. Text enclosed in single quotes is taken ‘literally’, i.e. the string will not undergo any processing and thus will contain exactly what is enclosed within the quotes. Text enclosed in double quotes is parsed by PHP, which will look for variable references and replace them with the variables values, among other things.
As I have already said the difference in execution time (if any) is not the primary difference, just a side effect of difference in processing. It is important to note that the difference would be extremely small and should play no part in your decision between the two.
June 27, 2008 at 3:22 pm
You are an incredible writer. This is one of the most well written tutorials I’ve read.
July 8, 2008 at 9:32 pm
Hi All,
I’m pretty new to PHP myself, but I stumbled upon a wonderful PHP editor. It’s Aptana Studio. Go to:
aptana.com
If you sign up for the early release of cloud, you can view PHP in the editor, instead of having to open it on the server, or how I do it, on local host.
Hope this helps,
snewoJ
July 26, 2008 at 5:44 pm
Thanks for the tutorial. I just finished the intro and am looking forward to completing the rest. For those working on a Mac w/ OS X, here’s some info:
TextWrangler (free text editor)
http://www.barebones.com/products/textwrangler/
Enabling PHP and Apache in Leopard
http://foundationphp.com/tutorials/php_leopard.php
November 11, 2008 at 5:44 am
Hi, i feel like a total idiot but i cant seem to get the php working on my mac. ive typed up the first code in this tutorial, the Neo dialogue but when i run it a browser it just shows up as raw code.
Im using MAMP on my machine, its turned on and the servers are running however I cant get these pages to load, help anyone?
December 29, 2008 at 1:16 pm
These tutorials are great. Thanks so much.
January 6, 2009 at 8:02 pm
I am trying to learn how to code in PHP, but I am not understanding the practical usage behind it. Any tutorial sites out there that can explain how to use these ideas?
January 7, 2009 at 3:32 am
Thanks to the writer of this tutorial. I like it very much. It is very simple and easy to learn. Hope I could learn more here.
February 5, 2009 at 9:16 pm
Did these yesterday and then went through them all a second time today.
Copied all the code 1st time, and uploaded it to my server and then on the 2nd try I basically attempted to write the code out from memory and uploaded it.
If it failed I looked at the 1st one again and then tried to change it.
Basically, nice tutorial, please dont ever take it down – would be handy with some video commentary too
)
cheers anyway
shaun
March 23, 2009 at 7:02 pm
I cant figure out how to download that program is there another site inwhich I can downlaod the program?
May 19, 2009 at 7:10 pm
This is the first time I’ve taken a look at PHP – I found this to be very easy-to-understand and interesting. I can’t wait to move on to the next tutorial! Thank you!!
June 5, 2009 at 7:47 pm
Once I realized that I didn’t need to download anything because the server I use, which isn’t mine, already had PHP installed and that the reason I was seeing raw code was due to writing the code in RTF instead of TXT, everything has gone smoothly.
Thanks for providing something so valuable for free. I’m beginning to think there is still hope for the human race.
Jefferson
June 7, 2009 at 2:16 pm
Well.. tutorial 1 definately is good.. their are a couple things i do not understand still from this tutorial, but will re read it.. basically its placements of symbols.. ‘ .. it almost makes sense.. im waiting for my brain to click..
June 14, 2009 at 11:44 pm
I usually prefer books over online tutorials, but you made the topic such a pleasant read that I was willing to sacrifice the comfort of my armchair in order to expand my knowledge through your tutorial.
I have tried out a few scripts and tested them on a shared web server which resides with my web host, and now there’s just one thing I am wondering about – would it compromise the security of my PC if I installed Apache locally? It seems that the configuration is quite a complex topic and I probably won’t ever need to change the vast majority of parameters, but are there any security issues I would have to look out for if I leave everything at default?
Thanks for advice.
July 4, 2009 at 5:32 pm
I used to build data driven applications using DbaseIV or Fox-Pro.
I left that i 1999 for CISCO Networking.
Now, i have a strong desire to bring back the programming part of my brain before i loose it
I tried ASP.NET, i could not………., so i left it.
Thank God i saw this PHP material: it’s already looking like this will work
Thanks
July 14, 2009 at 1:47 pm
Thnx, Good one for novice PHP developers like me.
July 25, 2009 at 2:52 pm
Just finished this tutorial, looks like I got it….moving on to step two, appreciate people like you who take the time to do something like this. Thanks alot.
September 24, 2009 at 7:13 pm
Thank you for all your work. Finally a great PHP tutorial. You should publish this.
November 10, 2009 at 9:21 pm
I have tried 12 different tutorials to get apache and php to work on my computer. No success on any of them . I have tried to use what the e-books say is a fully automatic setup . All I can get is a little icon that says no services started. The PHP installation is way over my head as for windows it lists so many things not to do. The end result is cpmple frustration and removing everything again and going back to the drawing board. I can run all the php scripts as I have a php enabled hosting service. But I can’t understand why i Can not use my computer as a server . I put all the stuff om my J drive to try to keep it separate..
Any comments I hate to be beaten by something everyone says is simple ???
December 1, 2009 at 12:10 pm
A tutorial after my own mind. Just the right pace and spiced up with good writing as well as humour.
Will be reading on.
Anna
December 2, 2009 at 11:34 pm
Do you have a tutorial on downloading and installing the PHP environment and Apache server? I followed the link you provided to download, and it took me to a tangled mass of hyperlinks and technical jargon.
I’m afraid if the installation process is any more complicated than a link that says "click here to download" then I’m going to need some help.
December 7, 2009 at 9:23 pm
Sounds like glorifiedg you might be a good candidate for Zend Server CE. It’s a free product that is just a download, click to install, and go situation.
April 19, 2010 at 12:26 am
great introductory tutorial
May 4, 2010 at 8:47 am
Okay, so I’ve tried to get the php code to actually run, but every time, it either offers me to download the php(if I run it the web) or tells me -file not found.(if I run it from my computer.) Help?
May 15, 2010 at 5:30 am
I appreciated your work here, Thanks a Lot
also you helped a lot of people good job!
May 23, 2010 at 11:04 am
this is very use full article for beginners
Javed PAPAS
June 2, 2010 at 11:41 am
Actually, acronyms are types of abbreviations that you can pronounce as a name, like NATO, Gestapo, FAQ or LAMP. Of those you mentioned, only SOAP is an acronym, the rest (PHP included) are just abbreviations.
Anyway, great introductory article.
June 10, 2010 at 8:01 am
Coming from someone in the teaching profession for 15 years, you’re tutorial is exceptionally clear. Thanks, dude.
June 18, 2010 at 1:49 pm
The way you explained things is quite outstanding. I enjoyed the Matrix part..not to mention..learnt php fundamentals too!
July 10, 2010 at 5:29 am
thanks a lot for the tutorial, which was very helpful. also thanks or the time and comedy invested into it that makes it enjoyable. keep it up.
<?php
$var1="Than";
$var1.="k you";
$var1.=" very much";
echo $var1;
?>
July 11, 2010 at 9:08 am
I love this tutorial it was my first with wring php
<?php
$best = ‘I L’;
$best .= ‘ove Z’;
$best .= ‘end & Php T’;
$best .= ‘hanks alot’;
echo $best;
?>
July 22, 2010 at 7:58 pm
I know this seems like a great tutorial on how to code with php, but it does not say much about how to download and install php.
I found this quick and easy way to start php on windows…
goto
http://www.linuxdocs.org/HOWTOs/PHP-HOWTO-3.html
and scroll down to
"3.2 Apache Webserver Quick-Install"
and download
PHPTriad.. and be sure to read the PHPTriad installation guide
hope this helps
September 10, 2010 at 11:17 pm
What’s the difference between Echo and Print?
December 28, 2010 at 9:13 am
Great tutorial! A good work s timeless and this proves as I am using it after 6 yrs of your preparng this.
March 30, 2011 at 8:32 pm
Like a monster in the wardrobe, if you actually get out from under the covers and pad nervously over to the wardrobe, you might find it was just your Mum’s old fur coat, wafting in the breeze from the window you left open. Like your Mum’s old fur coat, still a bit scary, but manageable. At least it’s not going to eat me.