Instructions includ, require and readfile

Instructions include, require and readfile

There are two instructions that allow you to switch to the code contents of another file also contains PHP code. Both of these instructions is given one parameter – the name of the file to include in the code (it can be the path to a file located on another web server). The difference between them is how to enable these files to the code. For instructions “require” the files are attached to the code before parsing, in every place where there is an instruction “require”.




The object has its own properties and can do with it different things. Class is not an object, but its definition (eg. The class is a dog, but not the specific copy). The class definition contains variables (object properties) and function (what you can do with these objects). By using such a convention programming time can be easier to describe the interactions between objects. Here's how to define a sample class and examples of actions on it. Example <?php // Start the class definition Basket - defining basket shop class Cart



The function is a piece of code that can be called using the name. We have already been given several functions provided by PHP, such as array (), each (), list (), explode () and implode (). Features recognized by the parentheses occurring after their name. In these brackets (if required) is given parameters for the function. Some functions




These are variables containing a structured set of variables. For those variables is accessed by a number in brackets given immediately after the variable name – the array. This number is called the index – the number of the variable in the array. The same is assigned a value to the array.



$ Array[0] = “Entering number 0”;
$ Array[1] = “Entering number 1”;
$ Array[2] = “Entering the number 2”;


Syntax switch

Syntax switch Syntax switch is a conditional statement, but one variable can be compared not with one value, but with a few. You can  not construct complex conditions - can…

Do … while loop

Do ... while loop The commands contained in the loop will be executed at least once - in the case of the while loop need not be so. If the…

The While Loop

The while loop Another type of loop is WHILE loop. It is used in situations where it is necessary to perform an operation until the condition. Example <? php while…


FOR loop Sometimes you need to perform an action specified number of times. It is used for the FOR loop. The overall record looks like this: Example <? php for…

Conditional Statements

Conditional Statements Is used to execute a user (or a block of instructions), but only under certain circumstances - predetermining condition is met (or the whole set of conditions). Example…


The operators are symbols that are used to manipulate variables. Operators are divided into: 1. The arithmetic operations that are used for numbers. 2. assignment for assigning a value to…

Close Menu