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:

File Upload Using Angular Js and Node Js

28-05-2018 AngularJs Node js file upload multer module

Time Sorting Ascending or Descending Order in Javascript

19-07-2017 Javascript ascending order descending order

Filter for insert HTML in Angular Js

06-03-2017 filter show html angular js html

How to get drop down value when drop down change using javascript

27-02-2017 onchange events dropdown javascript functions

Get Unique values from array/object in javascript

19-02-2017 javascript unique remove repeated values from array