- What will the following code block output?
for($i = 0; $i < 10; $i++){
echo $i;
if($i > 8){
echo '!';
} else {
echo '';
}
}
a. 012345678!9! b. 012345678!9!10 c. 0123456789! d. 0123456789!10! e. 12345678!9! f. 12345678!9!10! g. 123456789! h. 123456789!10!
echo 'true';
}else {
echo 'false';
}
class A{
public function publicF(){
echo 'A';
$this->protectedF();
$this->privateF();
}
protected function protectedF(){
echo 'A';
}
private function privateF(){
echo 'A';
}
}
class B extends A{
public function publicF(){
echo 'B';
parent::publicF();
}
protected function protectedF(){
echo 'B';
}
private function privateF(){
echo 'B';
}
}
$b = new B();
$b::publicF();
BAAA BABB BABA (Correct) AAA ABB Other:
What can we pass to call_user_func
function as a first argument? (provide all 4 correct answers)
String containing name of the function (correct)
String containing class and it's methods name, separated by "::" (correct)
String containing object variable name and it's method name, separated by "->"
String containing only method name, if we are calling this inside that object's body
Array of two elements, where first element is object and second – it's method name as a string (correct)
Array of functions
Anonymous function (correct)
1-d. 0123456789!10!