Example for Conditional Operator in php

16-04-2017 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:

How to convert html to pdf in Node js
12-03-2017 pdf convert html node js
Remove last two characters from given string
06-03-2017 substring javascript remove
Filter for insert HTML in Angular Js
06-03-2017 filter show html angular js html
How to remove last / value from url in javascript
27-02-2017 array javascript last value
Send Mail in Node Js
21-02-2017 node js mail npm module