Sr. PHP Programmer Question:
Download Job Interview Questions and Answers PDF
What is the value of "$day" in the below code?
Answer:
$wed= 1;
$day = ($wed==1) ? 'today' : 'tomorrow';
// $day is now set to 'today'
Companies often ask about the ternary operator (?). which is simply a shorthand for if else statements.
$day = ($wed==1) ? 'today' : 'tomorrow';
// $day is now set to 'today'
Companies often ask about the ternary operator (?). which is simply a shorthand for if else statements.
Download Senior PHP Programmer Interview Questions And Answers
PDF
Previous Question | Next Question |
What is the purpose of date() function? | What is the purpose of $_COOKIE variable in PHP? |