Monday, 13 June 2011

PHP Interview Questions and answers 3

Strings and regular expressionsWhat will be the answer of the following code snippet? 1echo 'Testing ' . 1 + 2 . '45'; Simply you will give the answer as : Testing 345 But the answer is : 245 That is because you can not sum a number with a string. The first part, before the plus mark is a string though there is 1 there. So engine will simply get it as 0 and the latter part as 245. so answer will be 245. variable interpolationUsing variable interpolation how we can print the following String? “I am visiting the php interview questions website”. The word “question” is inside a variable, $a = ‘question’; Answer is just, echo “I am visiting the php interview {$a}s website”; function return valueWhat will be the out put of the following code snippet? if(!r()) echo ‘aaa’; else echo...

Search here for "Freshers Jobs"