A control structure is block of code that is executed based on a condition. A repetition control structure repeats program statements based on the evaluation of a condition. PHP has the following repetition control structures:
Let’s take a look at how each of these repetition control structures function.
A good programming practice is called Do not Repeat Yourself (DRY). The idea is that you attempt to maximize code reuse. One way to do this is to write functions. A function is a block of code that you write once and then you can execute it multiple times from other parts of your code. Executing a function is called “calling” it. PHP allows you to write functions quite easily.
Variables are used by programmers to store values and to refer to those values in code. Variables in PHP need not be defined. Variable types also do not exist although variable scope does. All variables begin with a $ sign. Variable names can contain numbers, letters and underscores. Variable names can only begin with letters or underscores. PHP variables are case sensitive. For ex: $a is different from $A. Below are given some examples of valid variable names:
Coding according to w3c standards is a major selling point for website designers these days. But how hard is it really? Consider some of the differences between valid XHTML transitional and the usual sloppy HTML coding:
PHP Hypertext Preprocessor (PHP) is the most popular server-side scripting language on the world wide web. This guide is designed to introduce programmers familiar with other programming languages to PHP.
This guide will take the form of a series of posts that will cover PHP from the basics to intermediate level. In this post I will cover code delimiters, comments and PHP statements.