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:

Convert and download html to pdf without saving file

28-10-2018 node js convert html to pdf pdf download pdf without saving

How to search text in string using php ?

29-10-2017 php search string search

How to submit form using javascript or jquery.

16-04-2017 javascript jquery submit form

How to use request module in node js

16-03-2017 request module node js

Filter for change Date format (MM-dd-yyyy) in Angular Js

05-03-2017 mm-dd-yyyy date formats angular js