Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more ➡
Download
Standard view
Full view
of .
Add note
Save to My Library
Sync to mobile
Look up keyword
Like this
5Activity
×
0 of .
Results for:
No results containing your search query
P. 1
PHP Notes by Vikas Kadakkal

PHP Notes by Vikas Kadakkal

Ratings: (0)|Views: 571|Likes:
Published by vikaskpsc
PHP Notes
PHP Notes

More info:

Published by: vikaskpsc on Mar 08, 2012
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See More
See less

09/16/2013

pdf

text

original

 
 
PHP
Source :http://www.w3schools.com
 
PHP NOTE
What is PHP?
 
PHP standsfor
P
HP:
H
ypertext
P
reprocessor
 
PHP is a server-side scriptinglanguage, likeASP
 
PHP scripts areexecuted on theserver
 
PHP supportsmany databases(MySQL,Informix, Oracle,Sybase, Solid,PostgreSQL,Generic ODBC,etc.)
 
PHP is an opensource software
 
PHP is free todownload anduse
What is a PHP File?
 
PHP files cancontain text,HTML tags andscripts
 
PHP files arereturned to thebrowser as plainHTML
 
PHP files have afile extension of ".php", ".php3",or ".phtm
l"
What is MySQL?
 
MySQL is a database server
 
MySQL is ideal for both smalland large applications
 
MySQL supports standard SQL
 
MySQL compiles on a numberof platforms
 
MySQL is free to download anduse
PHP + MySQL
 
PHP combined with MySQLare cross-platform (you candevelop in Windows and serveon a Unix platform)
Why PHP?
 
PHP runs on differentplatforms (Windows, Linux,Unix, etc.)
 
PHP is compatible with almostall servers used today (Apache,IIS, etc.)
 
PHP is FREE to download fromthe official PHPresource:www.php.net 
 
PHP is easy to learn and runsefficiently on the server side
Where to Start?
To get access to a web server with PHPsupport, you can:
 
Install Apache (or IIS) onyour own server, install PHP,and MySQL
 
Or find a web hosting plan withPHP and MySQL support
VIKAS KADAKKALMob:9539313232 
PHP is a powerful tool formaking dynamic and interactiveWeb pages.PHP is the widely-used, free, andefficient alternative to competitorssuch as Microsoft's ASP.Here you will learn about PHP,and how to execute scripts on yourserver.
 
PHP NOTES Page 2
PHP NOTES
 
BY VIKAS KADAKKAL
 
PHPSyntax 
PHP code is executed on the server, and the plain HTML result is sent to thebrowser.
 
Basic PHPSyntax
 
A PHP scripting block always starts with
<?php
and ends with
?>
. A PHP scripting block can beplaced anywhere in the document.On servers with shorthand support enabled you can start a scripting block with <? and end with?>.For maximum compatibility, we recommend that you use the standard form (<?php) rather thanthe shorthand form.
<?php?>
A PHP file normally contains HTML tags, just like an HTML file, and some PHP scripting code.Below, we have an example of a simple PHP script which sends the text "Hello World" to thebrowser:
<html><body><?phpecho "Hello World";?></body></html>
Each code line in PHP must end with a semicolon. The semicolon is a separator and is used todistinguish one set of instructions from another.There are two basic statements to output text with PHP:
echo
and
print
. In the example abovewe have used the echo statement to output the text "Hello World".
Note:
The file must have a .php extension. If the file has a .html extension, the PHP code will notbe executed.
 
PHP NOTES Page 3
Commentsin PHP
 
In PHP, we use // to make a single-line comment or /* and */ to make a large comment block.
<html><body><?php//This is a comment/*This isa commentblock*/?></body></html>
PHPVariables
A variable is used to store information.
 
Variables are used for storing values, like text strings, numbers or arrays.When a variable is declared, it can be used over and over again in your script.All variables in PHP start with a $ sign symbol.The correct way of declaring a variable in PHP:
$var_name = value;
New PHP programmers often forget the $ sign at the beginning of the variable. In that case it willnot work.Let's try creating a variable containing a string, and a variable containing a number:
<?php$txt="Hello World!";$x=16;?>
PHP is a Loosely Typed Language
 
In PHP, a variable does not need to be declared before adding a value to it.In the example above, you see that you do not have to tell PHP which data type the variable is.PHP automatically converts the variable to the correct data type, depending on its value.

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->