Blog

PHP – Problem with issetor()

In case you haven’t seen it before, issetor() is a quick and dirty way of getting a value from a variable that may or may not be defined: function issetor(&$var, $default=NULL) { return isset($var) ? $var : $default; } One unfortunate side-effect that most people are unaware of is that Read more…

By Chris West, ago
Blog

JavaScript Quirks – Array Slicing Node Lists

For a while many developers, including myself, suggested that Array.prototype.slice() be used to turn any array-like object into an array. Recently, I was alerted to a scenario in which this does not work as expected. Let’s take the following code for example: var elems = document.body.getElementsByTagName('*'); var arrElems = Array.prototype.slice.call(elems, Read more…

By Chris West, ago