php - raq (rarely asked questions!)

13

Upload: suresh-pandian

Post on 15-Feb-2017

795 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: PHP - RAQ (Rarely Asked Questions!)
Page 2: PHP - RAQ (Rarely Asked Questions!)

/* Question No: 1 */What will be the output?

echo 0123 + 2;

/* Print result */

85

Page 3: PHP - RAQ (Rarely Asked Questions!)

/* Question No: 2 */What will be the output?

print <<<Sania"‘Team, Learn PHP!'"Sania;

/* Print result */

"‘Team, Learn PHP!'"

Page 4: PHP - RAQ (Rarely Asked Questions!)

/* Question No: 3 */What will be the output?

if('10 out of 10' == 10) {echo 'equals to 10';

}else {

echo 'not equals to 10';}

/* Print result */

equals to 10

Page 5: PHP - RAQ (Rarely Asked Questions!)

/* Question No: 4 */What will be the output?

echo (int) ((0.1 + 0.7) * 10);

/* Print result */

7

Page 6: PHP - RAQ (Rarely Asked Questions!)

/* Question No: 5 */What will be the output?

echo 'Testing ' . 1 + 2 . '45';

/* Print result */

245

Page 7: PHP - RAQ (Rarely Asked Questions!)

/* Question No: 6 */What will be the output?

$num = 10;

function multiply(){ $num = $num * 10;}

multiply();

echo $num;

/* Print result */

10

Page 8: PHP - RAQ (Rarely Asked Questions!)

/* Question No: 7 */What will be the output?

function myfunc($argument) {

echo $argument + 10;

}

$variable = 10;

echo "myfunc($variable) = " . myfunc($variable);

/* Print result */

20myfunc(10) =

Page 9: PHP - RAQ (Rarely Asked Questions!)

/* Question No: 8 */What will be the output?

$date = '07/09/2008';

print ereg_replace("([0-9]+)/([0-9]+)/([0-9]+)","\\2/\\1/\\3", $date);

/* Print result */

09/07/2008

Page 10: PHP - RAQ (Rarely Asked Questions!)

/* Question No: 9 */What will be the output when we run the below files (if no_file.php does not exist in the server)?

/* use_include.php */

include('no_file.php');print 'This code will print on the page';

/* use_require.php */

require('no_file.php');print 'This code will print on the page';

/* Print result */

1. will throw warning & print the statements2. will throw fatal error & does not print the statement

Page 11: PHP - RAQ (Rarely Asked Questions!)

/* Question No: 10 */What will be the output?

$a = array ('zero','one','two');

foreach ($a as &$v) {}

foreach ($a as $v) {}

print_r ($a);

/* Print result */

Array ( [0] => zero [1] => one [2] => one )

Page 12: PHP - RAQ (Rarely Asked Questions!)

/* Results… */

If you answered correctly for more than 6 questions…

/* Print result */

Your understanding level in PHP is VERY GOOD!

Page 13: PHP - RAQ (Rarely Asked Questions!)

Suresh [email protected]