Question: What is output of below script?
var_dump(0123 == 123); var_dump('0123' == 123); var_dump('0123' === 123);
Output
var_dump(0123 == 123);//false var_dump('0123' == 123); //true var_dump('0123' === 123);//false
Question: What is output of below script?
var_dump(true and false); var_dump(true && false); var_dump(true || false);
Output
var_dump(true and false); //false var_dump(true && false); //false var_dump(true || false); //true
Question: What is output of below script?
$a1=true and false; $a2=true && false; $a3=true || false; var_dump($a1); var_dump($a2); var_dump($a3);
Output
$a1=true and false; $a2=true && false; $a3=true || false; var_dump($a1);//true var_dump($a2);//false var_dump($a3);//true
Question: What is output of below script?
echo 10 + "10%" + "$10";
Output
echo 10 + "10%" + "$10"; //20
Reason: First 10 is 10
Second 10 is 10
Third 10 is 0 (Because start with $)
Question: What is output of below script?
$text = 'HELLO'; $text[1] = '$'; echo $text;
Output
$text = 'HELLO'; $text[1] = '$'; echo $text;//H$LLO
Question: What is output of below script?
$x = NULL; var_dump($x);
Output
$x = NULL; var_dump($x);/null
Question: Why do we use ob_start()?
Ob_start used to active the output buffering .
Question: What is a .htacces file?
.htaccess is a configuration file running on server.
Following task can be done with .htacces?
- URL Rewrite
- Website password protected.
- Restrict ip addresses
- PHP/Apache Configuration
- Set browser caching for Speed up application.
Question: What is the difference between compiler language and interpreted language?
Interpreted language executes line by line, if there is some error on a line it stops the execution of script. Compiler language can execute the whole script at a time and gives all the errors at a time. It does not stops the execution of script ,if there is some error on some line.
Question: What is type hinting?
Type hinting means the function specifies what type of parameters must be and if it is not of the correct type an error will occur.
Question: What will be output of following?
$x = 5; echo $x; echo "
"; echo $x+++$x++; echo "
"; echo $x; echo "
"; echo $x---$x--; echo "
"; echo $x;
Output
5
11
7
1
5
Question: What will be output of following?
$a = 1; $b = 2; echo $a,$b;
Output
12
Question: What will be output of following?
var_dump(0123 == 123); var_dump('0123' == 123); var_dump('0123' === 123);
Output
boolean false
boolean true
boolean false