Udjuni.com

udjuni.com search:




Starting to Program in PHP


As defined in the posting “Introduction to programming”, is the art of giving step-by-step instructions to a computer telling it to do whatever you want. There are many programming languages ranging from what is termed first generation languages which are represented in strings of binary digits (zeros and ones also known as Machine Code) to 4th generation languages.

Second generation languages , also known as Assembly language. This was an attempt to simplify the process of creating programs by using symbols and abbreviations to create sequences of instructions. An assembly was used to translate a completed assembly program into machine code required by the computer. This programming language however seemed to be too slow and required programmers to memorize the commands and abbreviations.

Third generation languages Are sometimes called high level languages. They provide a more natural means of develop programs by enabling users to create programs made out of English-like statements. Languages such as Cobol, C++, Java, Visual Basic, PHP and others.

Fourth generation languages - Were developed to allow non-technical users to develop applications.
If you are just starting out learning PHP, I assume that you have already downloaded a PHP compiler or Integrated Development Environment and a Web server. If you have not already done so, you can get the compiler from PHP Compiler download and Apache web server from Apache web server download and install those two on your computer. You might also want to read the user manuals.

Your first PHP Program


before you start coding, here are some things you need to know about the structure of a PHP proram:
  • PHP code must be enclosed between the following tags
     <?php and ?> 

  • Every variable name must be preceded by $ symbol to indicate it is a variable

  • Use the phase “echo M” or “print (M)” when you want to display something on the screen. Where M denotes the string to be printed

  • Every php statement ends with a semicolon.


For now, all you need to know is those and you should do just fine. Now here is your first code:

<?php
         echo “Hello world! I am new here…”;
    ?> 
Alternatively, if you configured your server to execute short PHP tags, you could use the following tags:
<?

           echo “Hello world! I am new here…”;
    ?> 
This little program should display the following text in your browser:

Hello world! I am new here…

In the next few postings, we will look at a more advanced piece of code.


RELATED ARTICLES:


Introduction to Programming
What exactly is programming? Programming can be defined as the art of telling a computer to do whatever you want it to. If you are reading this posting you probably started off with switching the computer on and then opened the browser that got you to this page. Every comp

Introduction to Java programming
Computer program as we learned in the posting Introduction to Programming

Starting to program in Java
Most java developers would describe it as an innovative programming language that enables a developer to write what is called "Applets" or pieces of java code that can be embedded in web pages. In addition to this benefit, compiled java code can be run on a variety of

Compiling and executing a java program
Java source code is always stored in a file with a .java file extension. Once you have created your source code, you simply save it with a .java extension and it is ready to be compiled. To compile your java code, you use the f

Did not find it? Try udjuni.com search:







© 2009 UdjunI LLC. All rights reserved | Privacy policy | Tutorial Index | RSS Feed