PHP 7: Go to php.net and search for a method that will allow the checking of any
ID: 3904072 • Letter: P
Question
PHP 7:
Go to php.net and search for a method that will allow the checking of any case of “Male” or “Female” from #1. Update the conditional statement to allow any version (Male, Male, male, Female, FEMALE, female, and so on). Hint: The characters in $value can be changed to all uppercase or all lowercase using the strtoupper or strtolower methods. Then check the string as all uppercase (MALE, FEMALE) or all lowercase (male, female) characters.
($value == ‘Male’ || $value == ‘Female’) ? $this ->dog_gender = $value : $error_message = FALSE;
Explanation / Answer
Following is the answer:
(ucfirst($value) == ‘Male’ || ucfirst($value) == ‘Female’) ? $this ->dog_gender = ucfirst($value) : $error_message = FALSE;
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.