PHP Tutorials
History and origin of PHP

- 2008-08-14
- Comments
- Wang Li
- 480
Some time in 1994 when Rasmus Lerdorf put together a bunch of Perl scripts to track down who was looking at his resume. Little by little, people started to get interested in the scripts, and they were later released as a package "Personal Home Page" tools (the first meaning of PHP). In view of the interest, he wrote a scripting engine and incorporated another tool to parse input from HTML forms: FI, Form Interpreter, thus creating what was called variously PHP/FI or PHP2. This was done around mid 1995.
Read More
Different versions of PHP - History and evolution of PHP

- 2008-11-21
- Comments
- Andi, Stig and Derick
- 480
It was eight years ago, when Rasmus Lerdorf first started developing PHP/FI. He could not have imagined that his creation would eventually lead to the development of PHP as we know it today, which is being used by millions of people. The first version of "PHP/FI," called Personal Homepage Tools/Form Interpreter, was a collection of Perl scripts in 1995. One of the basic features was a Perl-like language for handling form submissions, but it lacked many common useful language features, such as for loops.
Read More
Getting Started with PHP

- 2008-08-14
- Comments
- Wang Li (from php.net)
- 480
For the first and most common form, you need three things: PHP itself, a web server and a web browser. You probably already have a web browser, and depending on your operating system setup, you may also have a web server (e.g. Apache on Linux and MacOS X; IIS on Windows). You may also rent webspace at a company. This way, you don't need to set up anything on your own, only write your PHP scripts, upload it to the server you rent, and see the results in your browser.
Read More
Variables in PHP

- 2008-11-21
- Comments
- Andi, Stig and Derick
- 480
Variables in PHP are quite different from compiled languages such as C and Java. This is because their weakly typed nature, which in short means you don’t need to declare variables before using them, you don’t need to declare their type and, as a result, a variable can change the type of its value as much as you want.
Read More
Constants in PHP

- 2008-11-22
- Comments
- Andi, Stig and Derick
- 480
In PHP, you can define names, called constants, for simple values. As the name implies, you cannot change these constants once they represent a certain value. The names for constants have the same rules as PHP variables except that they don’t have the leading dollar sign. It is common practice in many programming languages - including PHP - to use uppercase letters for constant names, although you don’t have to. If you wish, which we do not recommend, you may define your constants as case-insensitive, thus not requiring code to use the correct casing when referring to your constants.
Read More
Strings in PHP

- 2008-11-21
- Comments
- Andi, Stig and Derick
- 480
Strings in PHP are a sequence of characters that are always internally nullterminated. However, unlike some other languages, such as C, PHP does not rely on the terminating null to calculate a string’s length, but remembers its length internally. This allows for easy handling of binary data in PHP - for example, creating an image on-the-fly and outputting it to the browser. The maximum length of strings varies according to the platform and C compiler, but you can expect it to support at least 2GB. Don’t write programs that test this limit because you’re likely to first reach your memory limit.
Read More
if Statements in PHP

- 2008-11-22
- Comments
- Andi, Stig and Derick
- 480
if statements are the most common conditional constructs, and they exist in most programming languages. The expression in the if statement is referred to as the truth expression. If the truth expression evaluates to true, the statement or statement list following it are executed; otherwise, they’re not.
Read More
switch Statements in PHP

- 2008-11-22
- Comments
- Andi, Stig and Derick
- 480
You can use the switch construct to elegantly replace certain lengthy if/ elseif constructs. It is given an expression and compares it to all possible case expressions listed in its body. When there’s a successful match, the following code is executed, ignoring any further case lines (execution does not stop when the next case is reached). The match is done internally using the regular equality operator (==), not the identical operator (===). You can use the break statement to end execution and skip to the code following the switch construct.
Read More
while loops in PHP

- 2008-11-22
- Comments
- Andi, Stig and Derick
- 480
while loops are the simplest kind of loops. In the beginning of each iteration, the while’s truth expression is evaluated. If it evaluates to true, the loop keeps on running and the statements inside it are executed. If it evaluates to false, the loop ends and the statement(s) inside the loop is skipped. For example, here’s one possible implementation of factorial, using a while loop (assuming $n contains the number for which we want to calculate the factorial):
Read More
do...while Loops in PHP

- 2008-11-22
- Comments
- Andi, Stig and Derick
- 480
The do...while loop is similar to the previous while loop, except that the truth expression is checked at the end of each iteration instead of at the beginning. This means that the loop always runs at least once.
Read More
for Loops in PHP

- 2008-11-22
- Comments
- Andi, Stig and Derick
- 480
The start expression is evaluated only once when the loop is reached. Usually it is used to initialize the loop control variable. The truth expression is evaluated in the beginning of every loop iteration. If true, the statements inside the loop will be executed; if false, the loop ends. The increment expression is evaluated at the end of every iteration before the truth expression is evaluated. Usually, it is used to increment the loop control variable, but it can be used for any other purpose as well. Both break and continue behave the same way as they do with while loops. continue causes evaluation of the increment expression before it re-evaluates the truth expression.
Read More
- Data Science
- Android
- AJAX
- ASP.net
- C
- C++
- C#
- Cocoa
- Cloud Computing
- HTML5
- Java
- Javascript
- JSF
- JSP
- J2ME
- Java Beans
- EJB
- JDBC
- Linux
- Mac OS X
- iPhone
- MySQL
- Office 365
- Perl
- PHP
- Python
- Ruby
- VB.net
- Hibernate
- Struts
- SAP
- Trends
- Tech Reviews
- WebServices
- XML
- Certification
- Interview
categories
Related Tutorials
PHP convert string to lower case
PHP code to write to a CSV file for Microsoft Applications
PHP code to write to a CSV file from MySQL query
PHP code to import from CSV file to MySQL
Password must include both numeric and alphabetic characters - Magento
Error: Length parameter must be greater than 0
PHP file upload prompts authentication for anonymous users
PHP file upload with IIS on windows XP/2000 etc
Multiple File Upload in PHP using IFRAME
Resume or Pause File Uploads in PHP
Exception in module wampmanager.exe at 000F15A0 in Windows 8
Archived Comments
1. how to read any xml file or i want to a universal
View Tutorial By: shankar lal at 2014-09-29 12:40:20
2. Dear !
Thanks for the article. Now
View Tutorial By: Mubasher at 2013-05-04 11:37:52
3. Thanks ... nice one with clear picture.
View Tutorial By: Nithin at 2012-04-01 06:58:41
4. A good and useful tutorial for beginners.
t
View Tutorial By: Hayk at 2010-01-12 10:55:15
5. I am using my NOKIA 6630 via usb connection, runni
View Tutorial By: muhin at 2010-04-19 21:37:02
6. Yeah, great article
View Tutorial By: smeagol_s at 2009-03-29 02:45:01
7. I have followed all steps but it is giving null po
View Tutorial By: she at 2013-01-14 06:02:27
8. it is Marvelous example.
View Tutorial By: princevijayakumar at 2010-08-04 07:56:33
9. Thanks a lot! This really helped!!!
View Tutorial By: SuperSeppel13 at 2009-04-14 04:25:06
10. Is so easy work with FacesContext. For me, the get
View Tutorial By: Fred at 2009-03-11 08:42:59