shared-arrays.php File Reference

Go to the source code of this file.

Functions

 array_export ($array_to_export, $name_of_array)
 array_merge_2 (&$array, &$array_i)
 array_merge_n ()
 endKey ($array)
 firstKey ($array)
 arrayColumnCompare ($x, $y, $column, $reverse=false)


Function Documentation

array_export ( array_to_export,
name_of_array 
)

array_merge_2 ( &$  array,
&$  array_i 
)

Merges two arrays of any dimension

This is the process' core! Here each array is merged with the current resulting one

Author:
Chema Barcala Calveiro <shemari75@mixmail.com>
Parameters:
array Resulting array - passed by reference
array_i Array to be merged - passed by reference

Definition at line 35 of file shared-arrays.php.

Referenced by commentHandler::addComment(), array_merge_n(), commentHandler::deleteComment(), and commentHandler::editComment().

array_merge_n (  ) 

Merges any number of arrays of any dimension

The arrays to be merged are passed as arguments to the function, which uses an external function (array_merge_2) to merge each of them with the resulting one as it's being constructed

Author:
Chema Barcala Calveiro <shemari75@mixmail.com>
Returns:
array Resulting array, once all have been merged

Definition at line 71 of file shared-arrays.php.

References array_merge_2().

Referenced by commentHandler::commentHandler().

Here is the call graph for this function:

arrayColumnCompare ( x,
y,
column,
reverse = false 
)

Compares two array elements (for use with usort), but with further added functionality. You pass a column ID to the function, and wether the comparison is reversed (from larger to smaller)

The following code sample shows two sample functions, which would sort an array according to the "title" column, in direct and reverse order respectively:

function compare_title($x, $y) { return arrayColumnCompare($x, $y, "title"); }
function compare_titlerev($x, $y) { return arrayColumnCompare($x, $y, "title", true); }

Parameters:
x The first of the elements to compare
y The second of the elements to compare
column The key of the column to sort
reverse Wether the search should be reversed. Default is to sort ascending
Returns:
Where to shift the array elements

Definition at line 118 of file shared-arrays.php.

Referenced by convention_compare_country(), convention_compare_remainingPayablerev(), ConventionHotelCompareName(), filesetup_compare_mimetype(), filesetup_compare_mtime(), filesetup_compare_size(), and filesetup_compare_title().

endKey ( array  ) 

firstKey ( array  ) 

Definition at line 94 of file shared-arrays.php.

Referenced by Convention::handleRegistration().


Generated on Sun Oct 26 20:33:14 2008 for The Travelsized Content Management System by  doxygen 1.5.5