By Ryan on January 7, 2010
Sometimes you don’t want to replace an element with another one, you just want a placeholder, so you can put it back later. I wrote takeOut and putBack to help out with that.
Element.implement({
takeOut: function(elementType) {
var elementType = ($type(elementType) == "string" ?
[...]
Posted in Mootools | Tagged element, implement, Mootools, putBack, takeOut
By Ryan on February 11, 2009
There is a function called array_rand but it only returns the key for a random element in an array. So here’s a quick function for you that can do it all in just a couple of lines.
function array_random($array) {
return $array[array_rand($array)];
}
Yes, the word array does appear four times, but that isn’t to confuse you but make [...]
Posted in PHP | Tagged array, element, PHP, random