Skip to content

Instantly share code, notes, and snippets.

@ichadhr
Last active September 24, 2021 07:40
Show Gist options
  • Save ichadhr/a89f9b2ec43147342eed560926c8ec3e to your computer and use it in GitHub Desktop.
Save ichadhr/a89f9b2ec43147342eed560926c8ec3e to your computer and use it in GitHub Desktop.
  1. What is the output of the following code:
$a = '1';
$b = &$a;
$b = "2$b";
echo $a.", ".$b;
  1. What is the difference between $_GET and $_POST?
  2. What does the isset() function mean?
  3. Convert bellow conditional statements to ternary conditional operator?
if ($val > 8) {
  echo 'bad';
} else {
  echo 'good';
}
  1. Explain how we handle exceptions in PHP?
  2. What are the uses of explode() and implode() functions?
  3. How can we load and call library in CodeIgniter framework?
@muhtaromzain
Copy link

  1. Line 2 Error
  2. $_GET berfungsi untuk menampilkan atau mengambil data dari database jika terkoneksi dengan database atau variable jika terkoneksi dengan class, sedangkan $_POST berfungsi untuk mengirim data dari form yang sudah disediakan lalu dikirim ke database.
  3. isset() fungsi ini berfungsi untuk mengecek apakah variable set yang kita assign memiliki data atau tidak.
  4. $val > 8 ? 'bad' : 'good'
  5. Dengan menggunakan try and catch jika try tidak berhasil pada catch letakkan exception error
  6. implode berfungsi untuk memisahkan array dengan memberikan separator, sedangkan explode() berfungsi menggabungkan suatu variable menjadi array
  7. $namaLibrary = new NamaLibrary();
    $namaLibrary->fungsiLibrary();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment