This function combines two arrays where the first array is treated as the key and the second array as the contents of the said table. The syntax goes like this : array_combine(array1,array2), wherein the array1 is the table which contains the keys values, and the array2 is the contents. It should be noted that these [...]
Filed under: Basic Programming, Sample Code by Avatar
No Comments »
Arrays are what tables are to C-based programming languages and what databases are for SQL-based languages. Arrays or tables as they are sometimes called can be used to store the contents of several variables and to create one, you use the following syntax:
Array(key=>value)
The array in the syntax refers to the name of the array being [...]
Filed under: Basic Programming, Sample Code by Avatar
No Comments »
Now, to make you a better programmer we all know the value of comments. This allows you to understand the code that you have written defining and given meaning to operations as you build them up. You start with the terminators used by PHP and end with them as well. Single line comments look like [...]
Filed under: Basic Programming, Sample Code by Avatar
No Comments »
As you might have seen, all of the PHP statement ends with �;� which would be somewhat similar to Perl. The valid HTML code that was handed back to the server was :
Who are You?
My name is MacGyver.
More in the coming posts when we dig deeper as we widen our understanding of PHP.
Filed under: Basic Programming, Sample Code by Avatar
No Comments »
The foreach loop is mostly used to parse through an array that for every loop, the value of the current array content/value is assigned to the $value (after which the array pointer increments by a factor of one) then the next loop results in the next array content/value.
Syntax:
foreach (array as value)
{
code to be executed;
}
Sample [...]
Filed under: Basic Programming, Sample Code by Celine
No Comments »
Sample :
Sample use of a function in a PHP script.
Filed under: Basic Programming, Sample Code by Avatar
No Comments »
The sample page in the previous post contains two input fields that are name and age, when the user inputs the data and clicks on the submit button, the form’s data is sent to the file “welcome.php” file. The resulting php file would look something like this:
Welcome .
You are years old
The output of the [...]
Filed under: Basic Programming, Sample Code by Celine
No Comments »
That’s how easy a function can be made to do a series of operations by being influenced by parameters. We now focus on the area of having functions that returns a value, say the processing of a block of code or an operation done on a set of data.
Sample :
The output of the code would [...]
Filed under: Basic Programming, Sample Code by Avatar
No Comments »
PHP as a scripting language means it is designed to work with ease of use on web page designs. Such pages often require the user to input data which can then be treated as input to the various elements of the program that are contained within the script to obtain the desired result. The PHP [...]
Filed under: Basic Programming, Sample Code by Avatar
No Comments »
The $_GET variable is an array of variable names with the corresponding values sent by the HTTP GET method. It is used to collect values from a form by using the method=”get”. All information sent by a form using this method is visible to all on the browser’s address bar but it is limited to [...]
Filed under: Basic Programming, Sample Code by Avatar
No Comments »