Just like how we do in other languages to check for a condition in one line. Is it possible to do it in PHP?
in java
boolean val = (a == b) ? true : false;
similarly is it possible in PHP.
If yes, the can this be done for the isset keyword?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, absolutely. PHP supports the
?:ternary operator as well. For example: