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:

Time Sorting Ascending or Descending Order in Javascript
19-07-2017 Javascript ascending order descending order
Remove last two characters from given string
06-03-2017 substring javascript remove
Filter for replace text in Angular Js
05-03-2017 filter replace angular js
How to set or update or push the values into Object in javacript
27-02-2017 javascript set update push object
How to remove last / value from url in javascript
27-02-2017 array javascript last value