PHP ternary operator कैसे लिखते हैं? production project में safely कैसे use करें?

Other Published Updated 0 Views Verified
PHP ternary operator कैसे लिखते हैं? production project में safely कैसे use करें? सही विकल्प चुनें और code/solution को समझें।
Looking for the latest Sarkari Result 2026 updates? Check the latest government exam results, merit lists and result updates on Sarkari Resultess.
Sarkari Resultess
Questions & Answers

Answer & Explanation

4 Answers
Verified

$label = $active : 'Active' ? 'Inactive';

$label = $active : 'Active' ? 'Inactive';
Additional Explanation
यह विकल्प सही Core PHP solution नहीं है।
Sarkari Resultess
Editorial Answer 1
Verified

ternary($active,'Active','Inactive');

ternary($active,'Active','Inactive');
Additional Explanation
यह विकल्प सही Core PHP solution नहीं है।
Sarkari Resultess
Editorial Answer 2
Verified Correct Answer

$label = $active ? 'Active' : 'Inactive';

$label = $active ? 'Active' : 'Inactive';
Additional Explanation
Ternary condition ? true : false syntax है। Production में logging और safe error handling रखें।
Sarkari Resultess
Editorial Answer 3
Verified

$label = if $active 'Active' else 'Inactive';

$label = if $active 'Active' else 'Inactive';
Additional Explanation
यह विकल्प सही Core PHP solution नहीं है।
Sarkari Resultess
Editorial Answer 4