function gronsCevir($quantity, $type = 'o'): string
{
    $ons = 28.3495231;
    return $type == 'o' ? $quantity . ' ons ' . $quantity * $ons . ' gram eder' : ($type == 'g' ? $quantity . ' gram ' . $quantity / $ons . '  ons eder' : 'Lütfen sadece gram (g) ve ons (o) giriniz');
}
echo gronsCevir(10,"g");
  