Ryan Rampersad
Opinions, Thoughts and Ideas - PHP, Java and Javascript
  • Home
  • About
  • Contact
Browse: Home / element

element

MooTools: takeOut and putBack methods

MooTools: takeOut and putBack methods

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 | Leave a response

Random Element from Array in PHP

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 | 2 Responses

Recent Posts

  • Setting Build Path has Encountered a Problem in Eclipse
  • Queue Ajax Requests in Mootools
  • CakePHP 1.3 Helper $text truncate error
  • CakePHP – 1and1 – 500 Internal Server Error
  • Easy CakePHP Database Settings Switching

Tags

(fluff)Grabber 2.7 2009 Apple array beta blog blogs Browser Browsers CakePHP chrome CSS Design Error Firefox fluff friends fluff grabber free Google html iGoogle internet explorer Java Javascript mac Microsoft Mootools music PHP plugin plurk program review School SEO solution string tip Tips update vista Windows windows 7 Wordpress

Search

Meta

  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org
QC: