How would you declare a function that receives one parameter name hello?
Answers
Answer:
Explanation:
If hello is true, then the function must print hello, but if the function doesn’t receive hello or hello is false the function must print bye.
1)<?php
2)function showMessage($hello=false){
3)echo ($hello) ? 'hello' : 'bye'
4) }
5)?>
<?php
function showMessage($hello=false){
echo ($hello) ? 'hello' : 'bye';
}
?>
In this question, you can evaluate if the developer knows how to declare a function and how they would manage the fact of the parameter can or cannot be on the function call. You can also evaluate if the developer knows the if syntax and how to print text(echo function).
showMessage(true);
1
showMessage(true);
★彡 ʜᴇʀᴇ ɪs ʏᴏᴜʀ ᴀɴsᴡᴡᴇ 彡★
If hello is true, then the function must print hello, but if the function doesn’t receive hello or hello is false the function must print bye.
ᴇʜsᴀss 彡★