explain ternary opertor in php

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

explain ternary opertor in php

Postby Joshi jahanvi » Sun Sep 14, 2014 3:32 pm

Explain the ternary conditional operator in PHP?


sonall gajera

Re: explain ternary opertor in php

Postby sonall gajera » Sun Jul 12, 2015 6:47 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 2 guests