Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

<?php $a=1; $b=2; $c=3; if($a<$b<$c) { echo 'success'; } else echo "failure"; ?> what would be output of this php script ?

user-image
Question added by Muhammed Basheer , Software Programmer , Nuventure Technology Solution
Date Posted: 2016/10/24
Jonathan de Flaugergues
by Jonathan de Flaugergues , software engineer , Abbeal

You won't have any output but a syntax error.

To compare three variables in php, you must to isolate each condition like this :

`if (($a < $b) < $c)` instead of  `if ($a < $b < $c)`

and you'll have success as output.

 

success 

because :b>a

and b<c

More Questions Like This

Do you need help in adding the right keywords to your CV? Let our CV writing experts help you.