Kuis Collections & Modern PHP — PHP

Kuis materi Collections & Modern PHP di PHP — uji pemahamanmu dengan pertanyaan pilihan ganda, penjelasan jawaban, dan skor langsung. Main gratis di Hyper Sheets.

Pertanyaan di kuis ini

  1. Buat collection dari array:
    $col = ___([1, 2, 3, 4, 5]);
  2. Filter collection elemen > 3:
    $hasil = collect([1,2,3,4,5])->___(fn($n) => $n > 3);
  3. Apa hasil dari:
    echo collect([10, 20, 30])->sum();
  4. Apa hasil dari:
    echo collect([1, 2, 3, 4])->map(fn($n) => $n * 2)->last();