Skip to content

Beginner-friendly PHP notes with simple English&Turkish ✨ ----- Basit İngilizce&Türkçe başlangıç ​​seviyesindeki PHP notları✨

Notifications You must be signed in to change notification settings

ebrar-M/php-beginner-notes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

Stars Forks Last Commit PHP

---

🌍 Languages


🇹🇷 TR Türkçe

🟨 PHP Programlama Dili - Temelleri

1. 📖 PHP Nedir?

  • PHP (Hypertext Preprocessor), web geliştirme için tasarlanmış bir sunucu taraflı betik dilidir.
  • HTML içine gömülebilir.
  • Dinamik web siteleri, CMS (WordPress), framework (Laravel) geliştirmede yaygın olarak kullanılır.

2. 🏗️ İlk PHP Programı

<?php
  echo "Merhaba PHP 🚀";
?>

📌 Açıklama:

  • <?php ... ?> → PHP kod bloğunu başlatır ve bitirir.
  • echo → ekrana yazı yazar.

3. 🔑 Değişkenler ve Veri Tipleri

<?php
  $sayi = 10;          // Integer
  $pi = 3.14;          // Float
  $isim = "Ebrar";     // String
  $dogruMu = true;     // Boolean
?>

📌 PHP’de tüm değişkenler $ ile başlar.


4. 🧮 Operatörler

<?php
  $a = 5;
  $b = 2;

  echo $a + $b; // Toplama
  echo $a - $b; // Çıkarma
  echo $a * $b; // Çarpma
  echo $a / $b; // Bölme
  echo $a % $b; // Mod
?>

5. 🔁 Koşullar ve Döngüler

If - Else

<?php
  $yas = 18;
  if ($yas >= 18) {
    echo "Reşitsiniz ✅";
  } else {
    echo "Reşit değilsiniz ❌";
  }
?>

Switch

<?php
  $gun = 3;
  switch ($gun) {
    case 1: echo "Pazartesi"; break;
    case 2: echo "Salı"; break;
    case 3: echo "Çarşamba"; break;
    default: echo "Bilinmiyor"; break;
  }
?>

For Döngüsü

<?php
  for ($i = 1; $i <= 5; $i++) {
    echo $i;
  }
?>

While Döngüsü

<?php
  $sayac = 0;
  while ($sayac < 3) {
    echo "Sayaç: $sayac";
    $sayac++;
  }
?>

6. 📦 Fonksiyonlar

<?php
  function kare($x) {
    return $x * $x;
  }

  echo kare(5);
?>

7. 🏗️ Diziler

<?php
  $meyveler = array("Elma", "Armut", "Muz");

  foreach ($meyveler as $meyve) {
    echo $meyve;
  }
?>

👉 Modern kullanım:

$meyveler = ["Elma", "Armut", "Muz"];

8. 🌐 Form İşleme (Kullanıcı Girişi)

📌 PHP genellikle form verisi işlemek için kullanılır.

<form method="post" action="ornek.php">
  İsim: <input type="text" name="isim">
  <input type="submit">
</form>
<?php
  $isim = $_POST["isim"];
  echo "Merhaba, $isim!";
?>

9. 🌈 İpuçları

✔️ Değişkenler $ ile başlar.
✔️ PHP dosyaları .php uzantılı olmalı.
✔️ Form verisi için $_GET ve $_POST kullanılır.
❌ Güvenlik için SQL Injection ve XSS açıklarına dikkat et!


🎯 Mini Alıştırmalar

  1. Kullanıcıdan isim al → “Merhaba, [isim]” yazdır.
  2. 1’den 100’e kadar sayıların toplamını ekrana yazdır.
  3. Bir dizi oluştur (["elma","armut","muz"]) → tümünü ekrana yazdır.
  4. Basit bir hesap makinesi (toplama, çıkarma) yap.

📌 Son Söz

PHP, web’in en çok kullanılan dillerinden biridir.
WordPress, Facebook’un ilk sürümü ve birçok dev proje PHP ile yazılmıştır.
Kısacası: Dinamik web = PHP 💛


🇬🇧 GB English

🟨 PHP Programming Language - Fundamentals

1. 📖 What is PHP?

  • PHP (Hypertext Preprocessor) is a server-side scripting language designed for web development.
  • It can be embedded in HTML.
  • It is widely used in developing dynamic websites, CMS (WordPress), and frameworks (Laravel).

2. 🏗️ First PHP Program

<?php
echo "Hello PHP 🚀";
?>

📌 Description:

  • <?php ... ?> → Starts and ends a block of PHP code.
  • echo → prints text to the screen.

3. 🔑 Variables and Data Types

<?php
$number = 10; // Integer
$pi = 3.14; // Float
$name = "Ebrar"; // String
$true = true; // Boolean
?>

📌 All variables in PHP start with $.


4. 🧮 Operators

<?php
$a = 5;

$b = 2;

echo $a + $b; // Addition
echo $a - $b; // Subtraction
echo $a * $b; // Multiplication
echo $a / $b; // Division
echo $a % $b; // Mode
?>

5. 🔁 Conditions and Loops

If - Else

<?php
$age = 18;
if ($age >= 18) {
echo "You are a minor ✅";
} else {
echo "You are a minor ❌";
}
?>

Switch

<?php
$day = 3;
switch ($day) {
case 1: echo "Monday"; break;
case 2: echo "Tuesday"; break;
case 3: echo "Wednesday"; break;
default: echo "Unknown"; break;
}
?>

For Loop

<?php
for ($i = 1; $i <= 5; $i++) {
echo $i;
}
?>

While Loop

<?php
$count = 0;
while ($counter < 3) {
echo "Counter: $counter";
$counter++;
}
?>

6. 📦 Functions

<?php
function square($x) {
return $x * $x;
}

echo square(5);
?>

7. 🏗️ Arrays

<?php
$fruits = array("Apple", "Pear", "Banana");

foreach ($fruits as $fruit) {
echo $fruit;
}
?>

👉 Modern usage:

$fruits = ["Apple", "Pear", "Banana"];

8. 🌐 Form Processing (User Login)

📌 PHP is generally used to process form data.

<form method="post" action="example.php">
Name: <input type="text" name="name">
<input type="submit">
</form>
<?php
$name = $_POST["name"];
echo "Hello, $name!";
?>

9. 🌈 Tips

✔️ Variables start with $. ✔️ PHP files must have the .php extension. ✔️ $_GET and $_POST are used for form data. ❌ Beware of SQL Injection and XSS vulnerabilities for security!


🎯 Mini Exercises

  1. Get the user's name → print "Hello, [name]".
  2. Print the sum of the numbers from 1 to 100.
  3. Create an array (["apple","pear","banana"]) → print all.
  4. Create a simple calculator (addition, subtraction).

📌 Final Word

PHP is one of the most widely used languages ​​on the web. WordPress, the first version of Facebook, and many other major projects are written in PHP. In short: Dynamic web = PHP 💛

About

Beginner-friendly PHP notes with simple English&Turkish ✨ ----- Basit İngilizce&Türkçe başlangıç ​​seviyesindeki PHP notları✨

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published