PHP: If Else condition assign to variable and call into string

admin

Administrator
Staff member
This may be simple and silly question but first I am learning php so your help would be appreciated.

I am trying to get variable with assigned conditional statement.

Code:
$gender = $curauth->gender; // getting from wordpress user profile.

if($gender === 'Male') {
    echo 'his';
} else {
    echo 'her';
}

So what I want to do is it will check if user is Male than in some description it will use his and if female it will use her. Something like below

Code:
echo 'jatin soni doesn't have set this option yet. His option will be deactivated soon.';

So here <strong>His</strong> will be set with above conditional code.