Featured Posts

  • Prev
  • Next

PHP

Posted on : 25-06-2011 | By : Tegoeh Chuzy | In : CMS

Tags: , , , , , , , , ,

0

PHPWhat is PHP?

I have been programming in PHP. What is PHP you may ask? PHP is a server-side scripting language for the Web. Server-side means that the PHP code is executed before a corresponding Web page appears in the code they sent to the browser. The data are then processed in the script, without which the browser will notice some of them. This has the advantage that such code will work regardless of browser. If Javascript is disabled in the browser, JavaScript can not be executed. PHP is becoming independent of it. However, PHP can be realized for the most part things other than using javascript.

How does it work?

PHP code is mixed directly with HTML typed on one side. Based on the extension (. Php or. Php4 or. Php3) the web server detects even before he sends the page to the browser that this is a page with PHP code. The PHP code is then processed and sent to the browser until the result. So PHP code, you can not see the source code of an HTML document, if it is allowed in the browser. HTML code is outside the PHP code remains unaffected.

PHP was designed from experience with Perl as a programming language developed for the Web. It avoids some problems that Perl has specially in web environments. Since PHP was created specifically for the web (for example, Perl can also be used in “off-line programs”), it also has a number of features that are especially interesting for the Web. PHP is free software, which is subject to an Open Source license. A commercial competitor to PHP, ASP, for example from Microsoft. Since the data processing is done on the server, but the page must be reloaded for interaction, which is in contrast to Javascript course a disadvantage.

What does it do?

PHP can be used anywhere, where HTML pages are designed to provide information, not static, but dynamic in some way, so changeable, will have content. It can be further processed such as user input from HTML forms with PHP. So PHP can send a mail or entries stored in a database. PHP has too many features for the database connection for example to a MySQL database. Such a database is not available, PHP can also write data into a plain text file and read it again. Form input can be tested on their completeness and usefulness. In short, can make interaction with PHP in any form on a website that would otherwise appear as a static entity. Frequent applications, discussion forums, counters, guest books, statistics, opinion polls, feedback forms are sending a mail and the like.

As an example, I leave here on this page by PHP code simply times your browser output your IP address, your host name and the current date, during the invocation of this page.

Your browser has to recognize itself as: Mozilla/5.0 (compatible; Windows NT 5.1; en-US; rv: 1.9.2.18) Gecko/20110614 AlexaToolbar/alxf-2.13 Firefox/3.6.18
and your IP address is: 182.5.123.147, and your host name is: 182.5.123.147
and the date is 25/06/2011

Due to the frequent demand I am publishing here the PHP code for the above issue of browser and IP address:

<Php $ host = gethostbyaddr ($ _SERVER ['REMOTE_ADDR']);
$ Date = date (“d.m.Y”, time ());
print “Your browser will be seen as: <b> $ _SERVER [HTTP_USER_AGENT] </ b> <br />
and your IP address is: <b> $ _SERVER [REMOTE_ADDR] </ b>, and your host name is: <b> $ host </ b> <br />
<b> and date $ date </ b> “;?>

The official website of the PHP Group can be found at http://www.php.net (English, some with German translation).

Related Post

Write a comment