PHP
In this part of the PHP tutorial, we will talk about the PHP programming language in general.Goal
The goal of this tutorial is to get you started with the PHP programming language. The tutorial covers the core of the PHP language. Variables, arrays, control structures and other core features. It does not cover web development, databases or other numerous topics. In this tutorial, we will cover PHP 5.PHP
PHP is a scripting language designed for web development. It is used to produce dynamic web pages. Currently, PHP is one of the most widely used programming languages. Much of its syntax is borrowed from C, Java and Perl with a couple of unique PHP-specific features. PHP can be embedded into HTML code and it generally runs on a web server. The web server needs to be configured to process PHP code and create web page content from it. It can be deployed on most web servers and operating systems. PHP is a free software. PHP was first created in 1995 and is actively developed since then. As of this writing, the newest version is PHP 5.3.1.PHP supports both object oriented and procedural programming styles.
The official web site for the PHP programming language is php.net
Programming languages
There are currently several widely used programming languages. The following list is based on the TIOBE Programming Community Index. The numbers are from December 2009. Note that these figures are only illustrative. No one knows the exact numbers.Position | Language | Ratings |
---|---|---|
1 | Java | 17% |
2 | C | 16.3% |
3 | PHP | 9.8% |
4 | C++ | 9.2% |
5 | Visual Basic | 7.8% |
6 | C# | 6.3% |
7 | Python | 5.2% |
8 | Javascript | 3.5% |
9 | PERL | 2.69% |
10 | Ruby | 2.65% |
PHP dominates over the Web. While Java is used mainly by large organizations, PHP is used by smaller companies and individuals.
Visual Basic represents the popularity of rapid application development and the dominance of Microsoft.
The C# was planned to be the next big language. It should compete mainly with Java and C/C++ languages.
Python, PERL and Ruby are the most widely used scripting languages. They share many similarities. They are close competitors.
PHP CLI
PHP CLI is a command line interpreter for the PHP language. It is useful for testing PHP scripts from the shell. In this tutorial, we will be using the PHP command line interpreter. This way we will focus on the core of the PHP language.There is a php5-cli module which we have to install in order to run PHP on the command line.
<?php
echo "this is PHP language\n";
?>
Here we have a simple PHP script.
$ php simple.php
this is PHP language
We execute the script.
Interactive shell
Like Python or Ruby, PHP also has an interactive shell. It is useful to test small language constructs.$ php -a
Interactive shell
php > print PHP_OS;
Linux
The PHP shell is invoked with the -a option of the php command.
The shell uses the php > prompt.
References
- php.net
- wikipedia.org
- Gutmans, Bakken, Rethans; PHP 5 Power Programming
0 comments:
Post a Comment