Saturday, February 16, 2008

String in PHP.......

Strings in PHP:
String variables are used for values that contains character strings.
In this tutorial we are going to look at some of the most common functions and operators used to manipulate strings in PHP.
After we create a string we can manipulate it. A string can be used directly in a function or it can be stored in a variable.
Below, the PHP script assigns the string "Hello World" to a string variable :
The output of the code above will be: Hello World

The Concatenation Operator:
There is only one string operator in PHP.

The output of the code above will be: Hello World 1234

If we look at the code above you see that we used the concatenation operator two times. This is because we had to insert a third string.
Between the two string variables we added a string with a single character, an empty space, to separate the two variables.

Monday, February 11, 2008

Comments & Variables in PHP.....

Comments in PHP:


Variables in PHP:

Variables are used for storing a values, like text strings, numbers or arrays.
When a variable is set it can be used over and over again in your script
All variables in PHP start with a $ sign symbol.
The correct way of setting a variable in PHP:



In PHP a variable does not need to be declared before being set.
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 how they are set.
In a strongly typed programming language, you have to declare (define) the type and name of the variable before using it.
In PHP the variable is declared automatically when you use it.

Saturday, February 9, 2008

Simple Code....

After install XAMPP or WAMP you have to run this server. Double click on XAMPP control panel after open click only Apache start button and close it. Then start the Internet Explorer and write the address: http://localhost/ and click enter, you will see its working or not.
Example:
In PHP what ever you write the code it must be put on C:\Program Files\xampp\htdocs\create a folder with name (like folder name: test)\your PHP file (like file name: index.php).



Then start the Internet Explorer and write the address : http://localhost/test click enter, you will see your code output.


Code output will be: Hello World

Each code line in PHP must end with a semicolon. The semicolon is a separator and is used to distinguish one set of instructions from another. There are two basic statements to output text with PHP: echo and print. In the example above we have used the echo statement to output the text "Hello World".

Friday, February 8, 2008

Download apache server from......

You need a server software like XAMPP or WAMP for run PHP codes. You can easily download from the link below. Its free......

for linux......
http://www.apachefriends.org/en/xampp-linux.html

for windows........
http://www.apachefriends.org/en/xampp-windows.html

Thursday, February 7, 2008

Introduction to PHP

What is PHP?
PHP stands for PHP: Hypertext Preprocessor
PHP is a server-side scripting language, like ASP
PHP scripts are executed on the server
PHP supports many databases (MySQL, Informix, Oracle, Sybase, Solid, PostgreSQL, Generic ODBC, etc.)
PHP is an open source software (OSS)
PHP is free to download and use .

What is a PHP File?
PHP files may contain text, HTML tags and scripts
PHP files are returned to the browser as plain HTML
PHP files have a file extension of ".php", ".php3", or ".phtml"

Why PHP?
PHP runs on different platforms (Windows, Linux, Unix, etc.)
PHP is compatible with almost all servers used today (Apache, IIS, etc.)
PHP is easy to learn and runs efficiently on the server side

Where to Start?
Install an Apache server on a Windows or Linux machine
Install PHP on a Windows or Linux machine
Install MySQL on a Windows or Linux machine

Also you can use Macromedia Dreamweaver for code writing.

Wednesday, February 6, 2008

About PHP......

PHP is a powerful server-side scripting language for creating dynamic and interactive websites.
Its widely-used, free, and efficient alternative to competitors such as Microsoft's ASP. PHP is perfectly suited for Web development and can be embedded directly into the HTML code.
The PHP syntax is very similar to Perl and C. PHP is often used together with Apache (web server) on various operating systems. It also supports ISAPI and can be used with Microsoft's IIS on Windows.