예제 #1
0
        $sex = $this->checkSex(substr($number, 0, 1));
        $date_of_birth = $this->checkBirthDate(substr($number, 5, 2), substr($number, 3, 2), substr($number, 1, 2));
        $text = "Person is: {$sex} in {$date_of_birth} \n";
        echo $text;
    }
    function checkSex($number)
    {
        if ($number < 5) {
            if ($number % 2) {
                return 'Male born in Hungary';
            } else {
                return 'Female born in Hungary';
            }
        } else {
            if ($number % 2) {
                return 'Male born outside of Hungary';
            } else {
                return 'Female born outside of Hungary';
            }
        }
    }
    function checkBirthDate($day, $month, $year)
    {
        return "{$day}-{$month}-{$year}";
    }
}
$query = "SELECT * FROM `numbers`";
$all_data = $mysqli->query($query);
$record = new Records();
$record->checkCountry($all_data);