Jump to content

PHP: Difference between revisions

162 bytes removed ,  28 September 2010
Remove legacy information.
No edit summary
(Remove legacy information.)
 
(7 intermediate revisions by one other user not shown)
Line 14: Line 14:
  cd ~/public_html
  cd ~/public_html


* Create a file called “hello.php” using a text editor.
* Create a file called ''hello.php'' using a text editor.


  nano hello.php
  nano hello.php


* Paste (or manually type, if you're a newb) this PHP code into the fine
* Type this PHP code into the file


#!/usr/local/bin/php
  <?php
  <?php
     echo “Hello World!”;
     echo "Hello World!";
  ?>
  ?>


Line 44: Line 43:
  <a href="http://www.example.com/links.php">Links</a> -
  <a href="http://www.example.com/links.php">Links</a> -
  <a href="http://www.example.com/contact.php">Contact Us</a>
  <a href="http://www.example.com/contact.php">Contact Us</a>
<br />


index.php
index.php
  <html><body>
  <html><body>
  <?php include("menu.php"); ?>
  <?php include("menu.php"); ?>
<p>Home page content</p>
  </body></html>
  </body></html>


Line 60: Line 57:
PHP variables can store any data you wish. They start with a $ sign and contain alphanumerical characters, but must always start with a letter.
PHP variables can store any data you wish. They start with a $ sign and contain alphanumerical characters, but must always start with a letter.
   
   
  $example1 = “example”;
  $example1 = "example";
  echo $example1;
  echo $example1;


This will output the text “example”.
This will output the text "example".


Variables as the name suggest can be altered after they're declared.
Variables as the name suggest can be altered after they're declared.


  $example1 = “altered example”;
  $example1 = "altered example";


$example1 now contains “altered example” and the previous contents are gone.
$example1 now contains "altered example" and the previous contents are gone.


[[Category:Helpdesk]]
[[Category:Helpdesk]]