changing if else conditions to those in php