# 1.3 PHP'de Echo ve Print

## PHP'de `echo` ve `print` Nedir?

PHP'de `echo` ve `print` fonksiyonları, ekrana çıktı vermek için kullanılır. İkisi de benzer işlevleri yerine getirir, ancak aralarında bazı küçük farklar vardır.

### **`echo`**

* **Kullanım:** `echo`, bir veya daha fazla dizeyi ekrana yazdırmak için kullanılır.
* **Özellikler:** Daha hızlıdır çünkü dönüş değeri yoktur.
* **Parametreler:** Birden fazla parametre alabilir (virgülle ayrılmış).

### **`print`**

* **Kullanım:** `print`, bir dizeyi ekrana yazdırmak için kullanılır.
* **Özellikler:** `print` bir değeri döndürür (1), bu nedenle fonksiyon olarak kullanılabilir.
* **Parametreler:** Sadece bir parametre alabilir.

## **`echo` Kullanımı**

```php
`<!DOCTYPE html>
<title>PHP echo ve print</title>
</head> 
<body>   
<?php 
    // Tek bir dize yazdırma     
    echo "Merhaba Dünya!";      
    // Birden fazla dize yazdırma     
    echo "Merhaba ". "Dünya!". " PHP'de echo kullanımı.";      
    // HTML ile birlikte echo kullanımı  
    echo "<h1>PHP echo ile Başlık</h1>";     
    echo "<p>Bu bir paragraf.</p>";   
      ?> 
</body>
</html>`
```

örnek 1:

```php
<?php 
    echo 'Hello World!';
	echo("Hi");
?>
```

örnek 2:

```php
<?php 
    echo 'Bottcamp ' . '2024';
?>
```

örnek 3:

```php
<?php 
    $color = "red";
	echo "My car is " . $color . "<br>";
	echo "My house is " . $COLOR . "<br>";
	echo "My boat is " . $coLOR . "<br>";
?>
```

örnek 4:

```php
<?php
	echo 'Yavuzlar </br> Sibervatan';
?>
```

örnek 5:

```php
<?php 
    echo '<p style="background:blue;"> Yavuzlar Sibervatan <p>';
?>
```

## **`print` Kullanımı**

```php
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>PHP echo ve print</title>
</head>
<body>
    <?php
    // Tek bir dize yazdırma
    print "Merhaba Dünya!";

    // HTML ile birlikte print kullanımı
    print "<h1>PHP print ile Başlık</h1>";
    print "<p>Bu bir paragraf.</p>";

    // Değişken kullanarak print
    $text = "Bu bir değişken.";
    print $text;
    ?>
</body>
</html>
```

### `echo` ve `print` Arasındaki Farklar

* `echo` birden fazla parametre alabilir, `print` sadece bir parametre alabilir.
* `echo` daha hızlıdır çünkü dönüş değeri yoktur.
* `print` her zaman 1 döndürür, bu nedenle bir ifade içinde kullanılabilir.


---

# 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/00x3-phpde-echo-ve-print.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.
