Question: What will be the output of the following code? function fn(&$var) { $var = $var - ($var/10 *5); return $var; } echo fn (100);
A
B
C
D
E
100
B
50
C
98
D
Error message
E
None of the above
Note: Not available
<?php
function magic($p, $q) {
return ($q == 0)?$p:magic($q, $p % $q);
}
?><?php
function myfunction() {
???????
print $string;
}
myfunction("Hello, World!");
?>
<?php
function &find_variable(&$one, &$two, &$three) {
if($one > 10 && $one < 20) return $one;
if($two > 10 && $two < 20) return $two;
if($three > 10 && $three < 20) return $three;
}
$one = 2;
$two = 20;
$three = 15;
$var = &find_variable($one, $two, $three);
$var++;
print "1: $one, 2: $two, 3: $three";
?>
$mystring, which of the following checks will correctly determine if the string PHP exists within it?$a in $obj_one and $obj_twowhen this script is executed?
<?php
class myClass {
private $a;
public function __construct() {
$this->a = 10;
}
public function printValue() {
print "The Value is: {$this->a}\n";
}
public function changeValue($val, $obj = null) {
if(is_null($obj)) {
$this->a = $val;
} else {
$obj->a = $val;
}
}
public function getValue() {
return $this->a;
}
}
$obj_one = new myClass();
$obj_two = new myClass();
$obj_one->changeValue(20, $obj_two);
$obj_two->changeValue($obj_two->getValue(), $obj_one);
$obj_two->printValue();
$obj_one->printValue();
?>