Wednesday, June 21, 2017

Interview Questions for PHP - 5 - Answers



Back- Interview Questions -5

Q1. I am trying to assign a variable the value of 0123, but it keeps coming up with a different number, what’s the problem?
Ans: PHP Interpreter treats numbers beginning with 0 as octal. 

Q2. Would I use print "$a dollars" or "{$a} dollars" to print out the amount of dollars in this example?
Ans: In this example it wouldn’t matter, since the variable is all by itself, but if you were to print something like "{$a},000,000 mln dollars", then you definitely need to use the braces.

Q3. How do I find out the number of parameters passed into function?
Ans: func_num_args() function returns the number of parameters passed in.

Q4. Explain the ternary conditional operator in PHP?
Ans: Expression preceding the ? is evaluated, if it’s true, then the expression preceding the : is executed, otherwise, the expression following : is executed.

Q5. When are you supposed to use endif to end the conditional statement?
Ans: When the original if was followed by : and then the code block without braces.






Tuesday, June 20, 2017

Interview Questions for PHP - 5


  1. I am trying to assign a variable the value of 0123, but it keeps coming up with a different number, what’s the problem?
  2. Would I use print "$a dollars" or "{$a} dollars" to print out the amount of dollars in this example?
  3. How do I find out the number of parameters passed into a function?
  4. Explain the ternary conditional operator in PHP?
  5. When are you supposed to use endif to end the conditional statement?


Wait for Answers .......Till Next Post.....Interview questions' answers.

click here for answers

Free Download PHP Interview Questions and Answers