Just a small post here to share a bit of benchmarking I just did. In Javascript, the boolean operators (|| and &&) behave a little differently to how many people expect. In PHP, the result of using || or && is always a boolean:
// PHP:
$x = "hello" || false; // bool(true)
$x = false || 0; [...]