---
title: "Explain the ternary conditional operator in PHP?"  
description: "Explain the ternary conditional operator in PHP?"  
author: "Anonymous User"  
published: 2012-05-04  
updated: 2020-09-17  
canonical: https://www.mindstick.com/interview/1434/explain-the-ternary-conditional-operator-in-php  
category: "php"  
tags: ["php"]  
reading_time: 1 minute  

---

# Explain the ternary conditional operator in PHP?

Expression preceding the '?' is evaluated, if it’s true, then the expression preceding the ':' is executed, otherwise, the expression following ':' is executed.

## Answers

### Answer by Anonymous User

Expression preceding the '?' is evaluated, if it’s true, then the expression preceding the ':' is executed, otherwise, the expression following ':' is executed.


---

Original Source: https://www.mindstick.com/interview/1434/explain-the-ternary-conditional-operator-in-php

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
