Sunday, February 1, 2009
Sorry i was busy.Now let start our first hello world program from PHP.
1- Open your NetBeans IDE from Start Menu.
2-Go to File/New Project/Select PHP from Category/PHP application/Next/Give HelloWorld to application name/Click Finish.
After you finish you will see a page with a bloc of code for index.php.I will will explain to you more about this file later.
// put your code here
Every php application starts with .
The php code goes within
You declare php variable with a dollar sign $ follow by the name of the variable.
For more info about definition go to php.net/documentation.
Let declare a variable named i and assign it 12;
Single quote is best way to handle string.Do not use "" for strings.Any variable
within "" will be Executed.
Php comment is c# style // or /* */
Let print it to the browser.The best browser for php is FireFox.
Now let print $i to the browser.
add code like this:
//to print hello world we use echo keyword or print
Note 5:Every variable declaration end with ; like c#
Run the project :Right click on index.php/Run.
You will see Firefox showing Hello World.
PHP is a loosy type.It mean you don`t have to define a variable type to use it.
Let me be clair.In C# if i want to declare an integer variable named i this is how i
will do it:
In php $i=12;so php is less trouble than c#,vb......
See you Next time.Remember to go to documentation section of php.net and copy
php keyword to a file named keyphp.txt on your desktop.
- Raleigh, NC, United States