Sometimes, the things matters. If you write this test program in PHP 4 (tested on 4.4.7): < ?php function test($arg) { echo "talk like a parrot."; } test(); ?> An error message pops up like the one below: Warning: Missing argument 1 for test() in /usr/bin/- on line 2 The error warning illustrates the position [...]
Filed under: Sample Code by Celine
No Comments »
The for statement on the other hand is used for loops that have a defined number of repetitions. The “for” statement requires three parameters; the initialization of a variable that would be incremented, the condition that is to be satisfied and the number of times the block of code is to be executed. If more [...]
Filed under: Basic Programming, Sample Code by Avatar
No Comments »
The loop statement is used to execute a block of code at least once then repeats the process as long as a set condition is true. As long as the condition results true the loop continues, exiting at false. Syntax: do { block of code to execute; } while (condition); Sample Code: The following code [...]
Filed under: Basic Programming, Sample Code by Avatar
No Comments »
A loop in PHP(as well in other languages) performs a block/chunk of code a specified number of times that can be used to save time when you want a piece of code to be executed at different times but with the same function. Loop statements are: while – performs the block/chunk of code as long [...]
Filed under: Basic Programming, Sample Code by Avatar
No Comments »
the funcxtion simply fills up an array with the contents you specify with the following syntax: aray_fill(start,number,value) Legend: start – a numeric value which denotes the starting index of the key (required) number – also a numeric value which denotes the number of entries (required) value – denotes the value which is to be inserted [...]
Filed under: Basic Programming, Sample Code by Avatar
No Comments »