Sebuah perintah yang dapat digunakan
untuk membagi beberapa kejadian dalam suatu kumpulan perintah yang lebih kecil
dangan berbagai kelengkapan di dalamnya baik itu pengecekan kondisi, fungsi
matematika maupun fungsi string. prosedur tidak dapat mengembalikan nilai.
Definisi Fungsi
Sedangkan definisi fungsi hampir sama
dengan definisi prosedur. bedanya fungsi adalah modul program yang
mengembalikan/mengirimkan sebuah nilai.
Dengan menggunakan prosedur atau
fungsi dapat menghemat banyak ruang atau ukuran program dan menghindari
pengetikan kode yang berulang-ulang.
Contoh Syntax PHP
function ini_fungsi($angka1,$angka2){ $jumlah=$angka1+$angka2; return $jumlah;
}
function ini_prosedur(){ $nomor1=2; $nomor2=3; echo “Ini adalah hasil penjumlahan
dengan prosedur :”.$tambah=$nomor1+$nomor2; echo “
”; echo
“Ini dicetak dari prosedur : Assalamualikum teman, anda sedang belajar PHP”;
}
echo “Ini adalah hasil penjumlahan
dengan fungsi : “.ini_fungsi(2,5);
echo “
”;
echo ini_prosedur();
?>
Penjelasan :
Fungsi adalah blok program yang dapat mengirim dan mengembalikan
nilai hasil setelah di proses.
Dapat dilihat bahwa syntax ini_fungsi(2,5) digunakan
untuk memanggil nama fungsi dan mengirim nilai untuk selanjutnya di proses
di fungsi tersebut.
Setelah di proses didalam variabel $jumlah, maka
nilainya dikembalikan ke posisi dimana fungsi tersebut tadi dipanggil return
$jumlah;
Sedangkan syntax ini_prosedur() adalah
sebuah prosedur.
Jangan terkecoh! walaupun dalam penulisan syntax
prosedurnya masih menggunakan syntax function ini_prosedur(){ tapi
ini adalah sebuah prosedur bukan fungsi karena kita tidak bisa mengirim
dan mengembalikan nilai.
Buktinya, walaupun di prosedur tadi ada printah operasi
penjumlahan $tambah=$nomor1+$nomor2, tapi nilainya sudah
tetap. kita tidak bisa memberikan nilai yang berubah-ubah pada prosedur
tersebut.
Artinya : prosedur hanya dapat menampilkan hasil dari
suatu blog proses
Walaupun didalam PHP tidak mengenal syntax prosedur,
tapi dalam PHP terdapat konsep prosedur.
The residue is dissolved in 100 parts of water, the solution is basified by the addition of sodium hydroxide solution, and the precipitated solid is extracted three times, each time with 50 parts of ether <a href=https://cialis.christmas>cialis tablets for sale</a> Heat maps to guide clinical decisions and counseling patients on the risks and benefits for pregnancy outcome
Medical Editor 1 2021 <a href=http://aviagra.best>buy viagra for male</a> The process of cancer development is a consequence of genetic and epigenetic alterations that lead to disruption of basic biological functions, such as cell division, differentiation, angiogenesis, and migration, and transform normal epithelium to preneoplastic lesions and then to invasive carcinoma
<a href=http://propecia.bond>propecia for sale in usa</a> When evaluating oncology patients with MAHA, their anticancer therapy and other drugs should be considered as a possible cause and any potential culprit agent stopped immediately
5 mg letrozole groups vs 4 in the megestrol acetate group, headache 7 and 6 vs 5, peripheral edema 7 and 3 vs 4, hot flushes 5 and 5 vs 4, fatigue 5 and 4 vs 6, weight gain 2 and 2 vs 9, and dyspnea 0 <a href=https://zithromax.buzz>where to buy valtrex</a> Robert Boostanfar, MD, FACOG; Michael Feinman, MD, FACOG, Alison Peck, MD, FACOG and David Tourgeman, MD, FACOG, diagnose and treat patients for a wide range of infertility problems with the most advanced reproductive technology
Jockey Brice Blanc, here to ride a young and un raced filly in an important workout, is right in the firing line <a href=http://stromectol.one>stromectol 3 mg dosage</a>
1992 Feb; 74 2 336 44 <a href=http://cialisshop.best>generic cialis online</a> The first time, I had never ever been on any oral medication for my acne and wasn t on birth control
1994; 47 1989 1998 <a href=https://aviagra.best>does generic viagra work</a> The former mainly includes Photorefractive Keratectomy PRK, Laser assisted Subepithelial Keratomileusis LASEK and Epipolis Laser in Situ Keratomileusis EPI LASIK, while Laser assisted in Situ Keratomileusis LASIK and Femtosecond Laser assisted LASIK FS LASIK belong to the latter 2
<a href=https://propecia.bond>propecia hair loss</a> The reference solubility values of SMX in acidic media were lower compared with their corresponding basic media due to the higher percentage of ionized drug in basic compared with acidic conditions