I think there is no need to convert it into switch case
, but you can simplify it like,
<?php
if($ridestatus == 'Y')
{
if($pass_status == 'Y' || $pass_status == 'NR')
$status="1";
elseif($pass_status == 'RNS')
$status="RNS";
}
elseif($ridestatus == 'RNS')
{
if($pass_status!='')
$status="RNS";
}
elseif($ridestatus == 'NR')
{
if($pass_status=='Y')
$status="1";
elseif($pass_status == 'RNS')
$status="RNS";
}
else
{
$status="";
}
?>
solved How to convert multiple if else in SWITCH case [closed]