hello friends! new(ish)!

PHP: Difference between revisions

From InstallGentoo Wiki v2
Jump to navigation Jump to search
>Beer
(Created page with "PHP is a server-side programming language that is very popular and often frowned upon. The acronym PHP was originally Personal Homepage to which later it changed its name to a...")
 
>Beer
Line 1: Line 1:
PHP is a server-side programming language that is very popular and often frowned upon. The acronym PHP was originally Personal Homepage to which later it changed its name to a more accurate Hypertext Pre-Processor. It uses a C style syntax and even a lot basic C functions.  
PHP is a server-side programming language that is very popular and often frowned upon. The acronym PHP was originally Personal Homepage to which later it changed its name to a more accurate Hypertext Pre-Processor. It uses a C style syntax and even a lot basic C functions.  
==Examples==
==Examples==
PHP is written inline with HTML documents, making it ideal for people who have experience with designing websites with HTML/CSS and want to create a more dynamic web experience. PHP is processed by the server before it is rendered in the browser.
All of the examples here assume that you have a rudimentary understanding of HTML and have webserver software installed on your system, or access to a webserver with PHP.
===Hello World!===
    <?php echo "Hello world!"; ?>
If you put this code into a file and give it a ''.php'' extension, it will render plain text to the web browser. As you can see every piece of PHP must be opened and closed with the PHP html tags.
===Date===
    <?php
        // variable declaration
        $date = date("Y/m/d");
   
        // using the variable with the echo function
        echo $date;
    ?>
[http://ca1.php.net/manual/en/function.date.php The Date function] is a great tool to show how PHP generates dynamic content. The above format displays the full year, the month and day all in numbers like so: 1999/02/16.


==Set Up==
==Set Up==

Revision as of 19:32, 28 January 2014

PHP is a server-side programming language that is very popular and often frowned upon. The acronym PHP was originally Personal Homepage to which later it changed its name to a more accurate Hypertext Pre-Processor. It uses a C style syntax and even a lot basic C functions.

Examples

PHP is written inline with HTML documents, making it ideal for people who have experience with designing websites with HTML/CSS and want to create a more dynamic web experience. PHP is processed by the server before it is rendered in the browser.

All of the examples here assume that you have a rudimentary understanding of HTML and have webserver software installed on your system, or access to a webserver with PHP.

Hello World!

   <?php echo "Hello world!"; ?>

If you put this code into a file and give it a .php extension, it will render plain text to the web browser. As you can see every piece of PHP must be opened and closed with the PHP html tags.

Date

   <?php
       // variable declaration
       $date = date("Y/m/d");
   
       // using the variable with the echo function
       echo $date;
   ?>

The Date function is a great tool to show how PHP generates dynamic content. The above format displays the full year, the month and day all in numbers like so: 1999/02/16.

Set Up

Linux/BSD

Apache

Nginx

Windows

Software