Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save lahmacun/0ade054f321fd9a51d95686a3d1c4a9e to your computer and use it in GitHub Desktop.
Save lahmacun/0ade054f321fd9a51d95686a3d1c4a9e to your computer and use it in GitHub Desktop.
<?php
function topla() {
$toplam = 0;
$argumanSayisi = func_num_args();
for ($i = 0; $i < $argumanSayisi; $i ++) {
$toplam += func_get_arg($i);
}
return $toplam;
}
function carpma() {
$carpim = 1;
$argumanSayisi = func_num_args();
for ($i = 0; $i < $argumanSayisi; $i ++) {
if (func_get_arg($i) == 0)
continue;
$carpim *= func_get_arg($i);
}
return $carpim;
}
// Ornek Kullanim
// echo carpma(2, 3, 4); // 24 dondurur
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment