Blog Archives

Yet another Javascript Internationalization (i18n) module

i18n? Internationalize (a.k.a. i18n) is a very basic practice when working with multi-lingual websites. A simple i18n mechanism involves only a dictionary containing the pairs of strings, and a dictionary lookup function (e.g. the underscore magic function _() ). Once these two things are ready, the implementation is relatively simple. Major programming frameworks also provide […]

PHP – isset() vs array_key_exists() : a better way to determine array element’s existence

The story In the CourseYou project, we’re asked to check if an element is set in an array. That is,  we’re asked to determine whether $Arr[‘MyElement’] exists. So we use the following code as a start. <?php if (isset($Arr[‘MyElement’])) { … do my stuff … } ?> This code works fine, but, it works fine […]

Equal (==), identical (===) and array comparison in PHP

Equal (==) If you use equal (==), you are allowing type conversion which means PHP will try to convert the two sides into the same type and then do the comparison. So even if the two sides are NOT the same thing, they MAY still be treat as the SAME. Consider this code: <?php $left […]

Kohana 3.1.2

Kohana 3.1.2 is released.