<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<?php
if (isset($_POST) && $_SERVER['REQUEST_METHOD'] == "POST") {
$sex = $_POST['sex'];
$check_sign = strlen($sex);
$pattern = $sex[$check_sign - 1];
if ($pattern == "a" || $pattern == "A") {
echo "kobieta";
}else {
echo "męzczyzna";
}
}
?>
<form action="" method="post">
<input type="text" name="sex" placeholder="Wpisz imie">
<input type="submit" value="sprawdz płeć" >
</form>
</body>
</html>