PHP array_flip() & intersect () functions

The function reverses the contents of an array with the keys as values and the values as keys with the following syntax: array_flip(array) Legend: array – array(name of the array) to be flipped Sample Code: Output : Array([Lizard] => 0 [Mouse] => 1 [Fish] => 2 ) PHP array_intersect() function Compares two or more arrays, [...]

Php array_diff_ukey()Function

This function compares the keys of one array with as many as you like. Only the keys of the first array is compared to another or as many as you like. The syntax goes like this: array_diff_ukey(array1, array2,array3….,fucntion) Legend: array1 – is the array to be compared with the other array’s function – is the [...]

Array_diff_uassoc Function

Next in line is array_diff_uassoc() function which compares two or more arrays while checking for differences before comparing the keys with a user-defined location. It then returns an array withthe keys and values from the first array(to which all the values were comapred against) it the function allows it. Syntax is as follows : array_diff_uassoc(array1,array2,array3….,function). [...]

Array_diff_assoc and array_diff_key Functions

The next array comparison functions is the array_diff_assoc(array1,array2,array3,array3…..), usage is similar with all of these array_diff functions varying only in the way the comparisons are done. Below is sample code for array_diff_assoc: Giving you : Array ([0] => Mouse [2] => Dog). Next we have the array_diff_key() function compares two or more arrays and returns [...]

Array_diff Function

The first function, array_diff() is used for comparing several tables or arrays which gives an array with the keys and values from the first array if the value is not available in the other arrays. Syntax is as follows : array_diff(array1,array2,array3……), where array 1 is the table to which all the other arrays will be [...]

Array Combine

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 [...]

Arrays

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 [...]

Embedding 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 [...]

More into the syntax of PHP

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 [...]

Loop Statement – foreach

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 [...]


Parse error: syntax error, unexpected T_STRING in /home/spm011/public_html/phpprogrammingguide/wp-content/themes/basic-concept-10/footer.php on line 8