Convert a javascript object to an array

The following code will convert an object to an array in Javascript, minding the order of the keys. The keys will be replaced with numbers:

 * Convert an object to an array
 * @param {object} obj The object to convert
var obj2array = function (obj) {
	var out = [],
		keys = Object.keys(obj),
		len = keys.length;


	for (i = 0; i < len; i++) {
	return out;
};Code language: PHP (php)