Test your skills with this PHP interview questions with short explanation.
Q1. What code will be printed?
1 2 3 4 5 6 7 8 9 |
<?php $x = 1; $m = 5; $y = 8; if ($y > $m > $x) { echo 'Yes'; } else { echo 'No'; } |
Q2. What are values of variables $a and $b?
1 2 3 4 |
<?php $a = '1'; $b = &$a; $b = "2$a"; |
Q3. How to read file with size of 256MB on a server with 128MB of RAM?
Q4. Write a function with side-effects
Q5. Write decorator for DefaultMailer Class that logs every sent email
1 2 3 4 5 6 7 8 |
<?php class DefaultMailer implements Mailer { public function mail(string $message) { ... } } |
Q6. Can the GET method contain Body?
Q7. What are differences between abstract class and interface?