# 1.6 Operatörler (Operators)

1. **Aritmetik Operatörler**:
   * `+` Toplama
   * `-` Çıkarma
   * `*` Çarpma
   * `/` Bölme
   * `%` Modülüs (bölümden kalan)

```php
    $a = 10; $b = 3; 
    echo $a + $b; // 13 
    echo $a - $b; // 7 
    echo $a * $b; // 30 
    echo $a / $b; // 3.3333... 
    echo $a % $b; // 1
```

2. **Atama Operatörleri**:
   * `=` Değer atama
   * `+=` Toplama ve atama
   * `-=` Çıkarma ve atama
   * `*=` Çarpma ve atama
   * `/=` Bölme ve atama

```php
    $x = 5; 
    $x += 3; // $x = $x + 3; -> 8 
    $y = 10; 
    $y -= 5; // $y = $y - 5; -> 5
```

3. **Karşılaştırma Operatörleri**:
   * `==` Eşitse
   * `!=` Eşit değilse
   * `>` Büyüktür
   * `<` Küçüktür
   * `>=` Büyük eşittir
   * `<=` Küçük eşittir

```php
    $a = 10; 
    $b = 5; 
    var_dump($a == $b); // false 
    var_dump($a != $b); // true 
    var_dump($a > $b); // true 
    var_dump($a <= $b); // false
```

4. **Mantıksal Operatörler**:
   * `&&` veya `and` Mantıksal VE
   * `||` veya `or` Mantıksal VEYA
   * `!` Mantıksal DEĞİL

```php
    $x = true; 
    $y = false; 
    var_dump($x && $y); // false 
    var_dump($x || $y); // true 
    var_dump(!$x); // false
```

5. **Dizi Operatörleri**:
   * `+` Dizi birleştirme
   * `==` Eşitse
   * `===` Aynı türde ve eşitse

```php
$array1 = array("a" => "kırmızı", "b" => "yeşil");
$array2 = array("c" => "mavi", "d" => "sarı");
$result = $array1 + $array2; // Birleştirme        
var_dump($result);
```

6. **Diğer Operatörler**:
   * `.=` Dize birleştirme ve atama
   * `++` Artırma
   * `--` Azaltma
   * `?:` Ternary operatörü

```php
    `$txt1 = "Merhaba";
     $txt2 = "Dünya!"; 
     echo $txt1 . " " . $txt2; // Dize birleştirme 
     $x = 5; 
     echo ++$x; // 6 
     $y = 10; 
     echo $y--; // 10`
```

Bu operatörler, PHP'de değişkenleri tanımlamak, verilerle çalışmak ve programların akışını kontrol etmek için kullanılır. Bu temel yapı taşları, PHP'de güçlü ve esnek uygulamalar geliştirmenize olanak sağlar.

A1) Bu örnekte, iki sayıyı toplayacağız, çıkaracağız, kalanını bulacağız ve eşit olup olmadıklarını kontrol edeceğiz.

```php
<?php
// Değişkenler
$sayi1 = 10;
$sayi2 = 5;

// Toplama işlemi
$toplam = $sayi1 + $sayi2;
echo "Toplam: " . $toplam . "\n";

// Çıkarma işlemi
$fark = $sayi1 - $sayi2;
echo "Fark: " . $fark . "\n";

// Kalan (Modülüs) işlemi
$kalan = $sayi1 % $sayi2;
echo "Kalan: " . $kalan . "\n";

// Eşit mi? (Karşılaştırma)
$esitMi = ($sayi1 == $sayi2);
echo "Eşit mi?: " . ($esitMi ? "Evet" : "Hayır") . "\n";
?>

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.yavuzlar.org/egitim/00x0-php-nedir/00x6-operatorler-operators.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
