Last active
August 29, 2015 14:07
-
-
Save rianorie/c0d603f5d3f5e295f8c1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$data = strtolower(trim($data)); | |
if ( ! strlen($data)) { // "" | |
$r = ''; | |
} elseif (is_numeric($data) || is_bool($data)) { // "0" "1" 0 1 false true | |
$r = ((bool)intval($data) ? 'Yes' : 'No'); | |
} elseif ($data == 'no' || $data == 'false') { // "no" "false" | |
$r = 'No'; | |
} else { // "yes" "true" | |
$r = 'Yes'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment