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 use request module in node js

16-03-2017 request module node js

How to find Angular Errors

06-03-2017 errors angularjs exceptionHandler

Email validation regular expression in javascript

22-02-2017 email validation regex

Get random strings from given string In javascript

21-02-2017 javascript random string