ternary conditional operator in php

It is for static page, dynamic page, website, SEO, performance and other web development discussion
Joshi jahanvi

ternary conditional operator in php

Postby Joshi jahanvi » Fri Oct 31, 2014 2:34 pm

How is the ternary conditional operator used in PHP?


sonall gajera

Re: ternary conditional operator in php

Postby sonall gajera » Wed Jul 08, 2015 8:58 am

The ternary conditional operator is of the form:

(expr1) ? (expr2) : (expr3)
If expression 1 evaluates to be TRUE the above evaluates to expression 2 else expression3.

Example:
$message = ($val = "60") ? "First class" : "Second class!";


Return to “PHP, HTML, MYSQL and Web Hosting”

Who is online

Users browsing this forum: No registered users and 1 guest