w3reference home
PHP Tutorial


Bookmark and Share

PHP Basics

  • PHP runs on different platforms.
  • PHP is compatible with almost all servers used today.
  • PHP is FREE to download from the official PHP resource.

How to save PHP files?

PHP files have the extention .php. PHP files are not different from HTML files. It is basically a simple HTML or any other SGML file having some php script in between. No matter where it is placed, PHP code is executed before any of the HTML code. The only difference is that the file must have the extention .php, else the parser will not parse it.

PHP syntax

A PHP block can occur anywhere in any SGML file. The syntax for the same is given below:
<?php
PHP script here
?>
Some servers have shorthand support and the syntax for PHP in such cases is:
<?
PHP script here
?>
But it's always recommended to avoid the shorthand way and use the former way. Have a look at a simple PHP script given below:
<html>
<body><?php
echo "My first PHP program";
?></body>
</html>
The above example will send the text "My first PHP program" to the browser. One thing to note is that every statement in the PHP code must have a semi-colon in the end. "echo" is a statement that outputs the text to the browser.
Code Validator
Learn FTP
Color finder
Link Checker
Free web designs
Coming soon!
Interview Questions...
'w3reference : Learn by examples ... Advanced to beginner's tutorials ...'
Ajax: AJAX tutorial1 | Apache: Apache HTTP Server | Restarting Apache | CSS: CSS Border | CSS Syntax | CSS Selector | CSS Comment | CVS: CVS Release | CVS Login | CVS Logout | CVS Annotate | Databases: Rolap Tutorial | OLAP Tutorial | OLTP Tutorial | data warehousing | Expect: HTML: html | Linux: Dot (.) conf files | Linux Mount Point | Linux Filesystem | SSH Tutorial | Linux Commands: cal | cat | cfdisk | chroot | MySQL: MySQL Commands | PHP: PHP Basics | PHP Variables | PHP Output (echo/print) | PHP String Concat | PL/SQL: PL/SQL Data Types | PL/SQL Control Structures | PL/SQL File Extensions | PL/SQL DBMS_OUTPUT package | Python: My first Python program | Shell: Starting Bash | Bash Redirection | Bash Pipes | Bash Variables | SQL: SQL Transactions | SQL Constraints | SQL Drop | SQL Union & Union All | SVN: svn architecture | SVN Repository | SVN Import | SVN Checkout | Tech: soap | Web Designing: Web Hosting | HTML/XHTML/CSS code validator | Learn FTP | Search Engine Optimization Tips | www: XML: XML vs HTML | XML Syntax | XML Tags, Elements and Attributes | XML Namespaces |
Sitemap | Disclaim | Privacy Policy | Contact | ©2007-2009 w3reference.com All Rights Reserved.