Monday, September 22, 2008
Function PHP
Its syntax and its construction similar to that of Java and Perl, unlike that PHP can be embedded in HTML code. PHP is also for the large family of descendants of C, whose syntax is very close.
In use Web, PHP code execution takes place as well: when a visitor asks to see a web page, the browser sends a request to the HTTP server correspondent. If the page is identified as a PHP script (usually through the extension. Php), the server calls the PHP interpreter to process and generate the final code of the page (usually consisting of HTML or XHTML, but also often Css and JS). This content is returned to the HTTP server, which sends finally to the customer.
This pattern explains this operation:
A further step is often added: that of dialogue between PHP and the database. Traditionally, PHP opens a connection to the server DBMS manner, it sends queries and get the result, before closing the connection.
Screenshot of vi background, displaying a PHP script, and right the result of the script interpreted by PHP
Screenshot of vi background, displaying a PHP script, and right the result of the script interpreted by PHP
Using PHP as a generator of dynamic web pages is the most widespread, but it can also be used as the programming language command line without using HTTP server or browser.
To achieve a PHP script executable from the command line, just as in Perl or bash to insert the code in the first line shebang: #! / Usr / bin / php (/ usr / bin / directory is the standard executable binary files on most distributions).
There is also an extension called PHP-GTK to create client applications on a computer graphics with the GTK graphics library.
PHP has many functions to operations on the file system, management of databases, sorting functions and hash, treatment of strings, generation and editing images, compression algorithms ...
The engine of Wikipedia is written in PHP with a MySQL database. It therefore fits in a LAMP platform.
In use Web, PHP code execution takes place as well: when a visitor asks to see a web page, the browser sends a request to the HTTP server correspondent. If the page is identified as a PHP script (usually through the extension. Php), the server calls the PHP interpreter to process and generate the final code of the page (usually consisting of HTML or XHTML, but also often Css and JS). This content is returned to the HTTP server, which sends finally to the customer.
This pattern explains this operation:
A further step is often added: that of dialogue between PHP and the database. Traditionally, PHP opens a connection to the server DBMS manner, it sends queries and get the result, before closing the connection.
Screenshot of vi background, displaying a PHP script, and right the result of the script interpreted by PHP
Screenshot of vi background, displaying a PHP script, and right the result of the script interpreted by PHP
Using PHP as a generator of dynamic web pages is the most widespread, but it can also be used as the programming language command line without using HTTP server or browser.
To achieve a PHP script executable from the command line, just as in Perl or bash to insert the code in the first line shebang: #! / Usr / bin / php (/ usr / bin / directory is the standard executable binary files on most distributions).
There is also an extension called PHP-GTK to create client applications on a computer graphics with the GTK graphics library.
PHP has many functions to operations on the file system, management of databases, sorting functions and hash, treatment of strings, generation and editing images, compression algorithms ...
The engine of Wikipedia is written in PHP with a MySQL database. It therefore fits in a LAMP platform.