php first course

php first course

    <html>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <body>

    <?php 

    echo "Ders 1"; 

    echo "<br>Merhaba Dünya";

    echo "<br>Ders 2";

    $name = "Fatih"; //string
    $age = "43"; //integer

    echo "<br>his name is $name and his age is $age"; //yazdırma


    echo "<br>constants";
    define('PI',3.14); // constant variable
    echo "<br>";
    echo PI;


    echo "<br>Ders 3";
    $tarih=1903;

    $cumle= "<br>$tarih 'de kurulan beşiktaş....";
    echo $cumle;

    echo "<br>Ders 4";
    $fname = "Johnny";
    $lname = "Cash";

    echo "<br>";
    echo $fname ." ". $lname;

    echo "<br>Ders 5";
    $word = "Hi Everyone"; // 0 dan başlar saymaya

    echo "<br>kelime uzunluğu:";
    echo strlen($word);

    echo "<br> Ders 6 ";
    $word2 = "find me";
    echo "<br>";
    echo strpos($word2,"me");

    echo "<br> Ders 7 array ";
    $modeller = array("BMW","Mercedes","Mazda");
    $puanlar = array("Ali" => 10,"Ayse"=>25);
    $puanlar2["Ahmet"]=15;
    $puanlar2["Cemil"]=23;
    $aileler = array("Fehim" => array("Can","Ali"),"Tasci"=>array("Cem","Ayse")); //Array in Array

    for($i=0; $i<3; $i++)
    {
        echo "<br>";
        echo $modeller[$i];
    }

    for($i=0; $i<2; $i++)
    {
        echo "<br>isim:",$aileler["Fehim"][$i];
        echo "<br>isim:",$aileler["Tasci"][$i];
    }

    $sayilar = array("bir","iki","uc");
    foreach($sayilar as $value)
    {
        echo "<br>",$value;
        }
    echo "<br> Sampiyon Besiktas";

    echo "<br> Ders 8 functions ";

    AdimiYaz();
    function AdimiYaz() //değişkensiz
    {
        echo "<br>Mehmet Ali Cin";  
        }

    AdiYaz("Mhmt"); //değişken al
    function AdiYaz($isim)
    {
        echo "<br>", $isim;    
        }

    echo "<br>",kare(9);
    function kare($sayi) //değer döndür
    {
    return $sayi * $sayi;   
        }
        

        
        
    ?>
    </body>
    </html>