/**
 * THESE FUNCTIONS ARE ALL INSPIRED BY PHP FUNCTIONS
 * @author: james revillini
 */


/**
 * returns the current array element based on its internal pointer and advances the internal pointer
 */
function each (a) {
	if (!a.cursor) rewind(a);
	return (a[a.cursor++]);
};

/**
 * returns the current array element based on its internal pointer and advances the internal pointer
 */
function next (a) {
	if (!a.cursor) rewind(a);
	return (a[++a.cursor]);
};

/**
 * sets the internal pointer of the array and returns the element
 */
function rewind (a) {
	a.cursor = 0;
	return (a[a.cursor]);
};
