Example for Conditional Operator in php

php
Conditional Operator
example

Try following example to understand the conditional operator.

$a = 10;
$b = 20;

 /* If condition is true then assign a to result otheriwse b */
$result = ($a > $b ) ? $a :$b;
echo $result;

Here $a is if condition and $b is in else condition.

 

 

You might also like:

Compare the Triplets | Javascript | hackerrank.com

07-05-2020 hackerrank.com

How to search text in string using php ?

29-10-2017 php search string search

Sanitization in java sript

14-03-2017 sanitization java script

Change datepicker display format

06-03-2017 datepicker angular js

Send Mail in Node Js

21-02-2017 node js mail npm module