Posted by mike | Posted on 30-01-2012
Category : Weekly Test
What is the output of the following code?
…
…
…
…
…
…
…
…
…
ANSWER:
Because the number starts with a zero, it is interpreted as an Octal number instead of a decimal. This means instead of returning 42 as one might expect, it returns the octal calculation:
0 = signify Octal
4 = 4 x 8 = 32
2 = 2 X 1 = 2
—————-
34
Posted by mike | Posted on 23-01-2012
Category : Weekly Test
What does the following code echo out:
|
|
if('ORANGE' > 'apple') {
echo 'orange';
} else {
echo 'apple';
} |
→ Continue
Posted by mike | Posted on 16-01-2012
Category : Weekly Test
True or False: In PHP 5.4 Traits can have properties?
→ Continue
Posted by mike | Posted on 08-10-2011
Category : Weekly Test
What does the following code produce in PHP 5.0+
|
|
$var = (object) array('0'=>'hello world');
if(isset($var[0])) {
die('Is Set');
}
die('Not Set'); |
→ Continue
Posted by mike | Posted on 28-09-2011
Category : Weekly Test
In PHP empty(array()) returns true, where-as empty(array(1)) returns false. What does the following code produce in PHP 5.0+
|
|
$var = (object) array();
if(empty($var)) {
die('Is Empty');
} else {
die('Is Not Empty');
} |
→ Continue
Posted by mike | Posted on 12-09-2011
Category : Weekly Test
Assuming $cache->load($key) contains a cache of “yes” and $mediaCacheEnabled = true, what will the var_dump of $data return in this case?
|
|
if (!$data = $cache->load($key) || !$mediaCacheEnabled) {
$data = 'no';
}
var_dump($data); |
→ Continue