Last active
October 13, 2015 14:14
-
-
Save kemalkanok/c0ef625c137bd4f9d822 to your computer and use it in GitHub Desktop.
php 101 eğitimi fonksiyon destekli ders kodları
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @return int|string | |
*/ | |
function atama() | |
{ | |
$a = 5; | |
$a = 'deneme'; | |
echo $a; | |
return $a; | |
} | |
$a = atama(); | |
/** | |
* @return int | |
*/ | |
function ilkİfKullanimi() | |
{ | |
$a = 0; | |
$a = 1; | |
$a = 1; | |
if ($a) { | |
echo ' dogru'; | |
} | |
echo $a; | |
return $a; | |
} | |
$a = ilkİfKullanimi(); | |
/** | |
* @param $a | |
* @return int | |
*/ | |
function esitlemeDenemeleri($a) | |
{ | |
$a *= 5; | |
$a /= 5; | |
$a += 5; | |
$a -= 5; | |
$a--; | |
return $a; | |
} | |
$a = esitlemeDenemeleri($a); | |
/** | |
* @return int | |
*/ | |
function forContinueVeBreakİslemleri() | |
{ | |
for ($i = 0; $i <= 8; $i++) { | |
if ($i == 0) { | |
echo 'bunu sayma'; | |
echo '=>'; | |
continue; | |
} | |
if ($i == 5) { | |
echo '<='; | |
break; | |
} | |
echo $i; | |
} | |
return $i; | |
} | |
$i = forContinueVeBreakİslemleri(); | |
$i = 0; | |
/** | |
* @param $i | |
* @return mixed | |
*/ | |
function whileDenemesi($i) | |
{ | |
while ($i <= 8) { | |
if ($i == 1) { | |
echo 'bunu sayma'; | |
echo '=>'; | |
$i++; | |
continue; | |
} | |
if ($i == 5) { | |
echo '<='; | |
break; | |
} | |
echo $i; | |
$i++; | |
} | |
return $i; | |
} | |
$i = whileDenemesi($i); | |
echo "<br/>"; | |
/** | |
* @return array | |
*/ | |
function KareCizimi() | |
{ | |
/** | |
* Kare | |
*/ | |
for ($i = 0; $i < 4; $i++) { | |
for ($j = 0; $j < 4; $j++) { | |
echo "*"; | |
} | |
echo "<br/>"; | |
} | |
echo "<br/>"; | |
} | |
list($i, $j) = KareCizimi(); | |
/** | |
* @return array | |
*/ | |
function TersUcgen() | |
{ | |
/** | |
* Ters Üçgen | |
*/ | |
for ($i = 0; $i < 4; $i++) { | |
for ($j = $i; $j < 4; $j++) { | |
echo "*"; | |
} | |
echo "<br/>"; | |
} | |
echo "<br/>"; | |
} | |
list($i, $j) = TersUcgen(); | |
function Ucgen() | |
{ | |
/** | |
* Üçgen | |
*/ | |
for ($i = 0; $i < 4; $i++) { | |
for ($j = 0; $j < 1 + $i; $j++) { | |
echo "*"; | |
} | |
echo "<br/>"; | |
} | |
} | |
Ucgen(); | |
/** | |
* @param $a | |
*/ | |
function yeniKomutlar($a) | |
{ | |
var_dump($a); | |
print_r($a); | |
echo $a; | |
printf('%.2f', $a); | |
if ($a) { | |
echo 'done'; | |
} else { | |
echo 'fail'; | |
} | |
echo $a; | |
} | |
yeniKomutlar($a); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
derse katılmayanlar için açıklamalar çok yetersiz mesela yeni komutların ne anlama geldiğini bilmiyoruz biraz daha bol yorumlu döküman hazırlanabilir.....
arz ederim saygılar..... :)