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:

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 insert HTML in Angular Js

06-03-2017 filter show html angular js html

Filters for convert text to camel case in Angular Js

05-03-2017 angularjs camelcase filters

How to change background color and color to the text using javascript

27-02-2017 css javascript colors