| PHP Tutorial | PHP Resources | PHP Server | |
<?php
?> All of your php codes should be placed within this tags or else it will be treated as a common HTML codes. In order for you to display a text or whatever calculation result within the browser for a visitor to see, you need to use 'echo' or 'print' command. Take a look at the simple script below to prints out the word 'Hello there!' <?php
?> When this script is executed, you will see the word 'Hello there!' in your browser. The double quotes are for non-variables and numeric while the ; tells php that it is the end of one command. Give it a try and you will find that php is pretty simple language to learn. In php, it is possible for you to define your own variables. Now we are going to define variables with a simple calculations <?php
?> In this php code, there are 3 variables defined. First is the revenue, second is expenses and the last one is the calculation on finding the net income. Thus, here is what it does! Firstly, PHP will tend to read those variables and store it within the server. After reading the first line, PHP knows that variable revenue has the value of 27000. Then it continues to second line. Now it get another variable. Since there still no calculation command founded, it store those variable on the server for later use. It had collect 2 variables and then continue to the third line. Oh .... it is a calculation. A new variable is again defined by substracting the value of $revenue and $expenses. So, PHP takes those variables which had already defined previously for this calculation and store the new one on the server as well. Now, it moves to the next line. It has the echo command. So the result will be shown like this: My monthly income is 7000
Notice on how the echo command is written. First, it has the double quotes to
wrap the text and a single dot ' . ' known as concatenation which tells PHP to
combine calculation result stored in the $income variable into a string.
|
Optimize Website - Webmasters optimize their site and gain higher search engine ranking Webmaster tools - Free online webmaster toolkits, website reporting and free PHP opensource scripts. Free Photo Hosting - Free File Hosting, Free ZIP file Hosting, Free Image Hosting, Free MP3 Hosting. Stupid Videos - Custom Pimped Motorcycle Pictures, Videos, and Articles Planet Diaz - Programming Community - Online programming resource for programmers all around the world Forectory - Webmaster Directory St Louis Computer NetworkingWebsite Templates - 1000s of Templates $5 - Many Templates to help you build your site!
|
Each and every tutorial published in PHPhelps.com
is originally written by PHPHELPS OWNERS. None of the content is allowed
to be replicated without prior notice to writter. Copyright © 2006 PHPhelps.com |