www.pickatutorial.com Computer Tutorials
Top eBooks: C/C++ | C# | Android | Mathematics | Database | Cloud | Graphics | Networking | Oracle | Hardware | AI
Top Tutorials: C/C++ | C#.NET | PHP MySQL | Java | Java Script | jQuery | HTML | xHTML | HTML5 | VB Script| CSS
Lessons PHP First Program Bookmark and Share
Lesson 1
Lesson 2
Lesson 3
Lesson 4
Lesson 5
Lesson 6
Lesson 7
Lesson 8
Lesson 9
Lesson 10
Lesson 11
Lesson 12
Lesson 13
Lesson 14
Lesson 15
Lesson 16
Lesson 17
Lesson 18
Lesson 19
Lesson 20
Lesson 21
Lesson 22
Lesson 23
Lesson 24
Lesson 25
Lesson 26
Lesson 27
Lesson 28
Lesson 29
Lesson 30
Lesson 31
Lesson 32
Lesson 33
Lesson 34
Lesson 35
Lesson 36
Lesson 37
Lesson 38
Lesson 39
Lesson 40
Lesson 41
Lesson 42
Lesson 43
Lesson 44
Before coding our first PHP program, we need to understand about PHP files.

What is a PHP File?
PHP files may contain text, HTML tags and scripts. PHP files are stored on the web server. PHP files have a file extension of ".php", ".php3", or ".phtml". .php is often preferred. A PHP script is run on the web server and not on the user's browser. Therefore, client-side compatibility issues are not of concern of the programmer as the server side script simply returns an HTML document for the user's browser to render. We need three things to make this work: the PHP parser (CGI or server module), a web server and a web browser.

PHP Hello World
Following is our first PHP Hello World program.
     <title>PHP Hello World</title>
	<?php // start of php code
      	echo '<p>Hello World</p>'; 
The code written within "php" tags is parsed by the PHP processor and the rest is ignored. Hence, a PHP parser would convert the above code into the following HTML document and send it back to the browser.
    <title>PHP Hello World </title> 
	<p>Hello World</p> 
Points to Remember:
  • PHP code is written within the <?php and ?> tag.
  • You can have as many number of php code blocks in a program as you need.
  • Every php command or statement ends with a semicolon ";".
  • A PHP scripting block <?php ?> can be placed anywhere in the document.
  • The echo is a PHP statement that is used to output text. In fact there are two basic statements to output text with PHP: echo and print. Their usage is identical.
  • Please note that you must save the above file with .php extension or the code will not be executed.

  • Home - Advertise - Contact - Disclaimer - About Us
    © Since 2006 pickatutorial.com -- All Rights Reserved.