Warning: Invalid argument supplied for foreach() di PHP

Operator Modulus
Operator Modulus

Pamulang – Kebiasaan ngeblok warning biar ga nongol dan akhirnya risih aja pas gunain foreach, nongol itu warning Invalid argument supplied for foreach(). Menururt gw sih kayaknya itu warning nongol gegara nilai array itu jangan NULL alias kosong. Kasus gw disini coba gw jabarin biar enak ngintip kodenya..

Class buat manggil data news..

Kode awal yg gw gunain akhirnya muncul itu warning..

Karena kebiasaan di fungsi itu gw masupin fungsi biar warning ga nongol, jadinya gw pikir kode ini ga masalah. Dan ternyata pas dieksekusi nongol dah itu warning.. Lanjut ke bagian ngatasin masalahnya…

Kode lengkapnya..

DONE!!! Semoga bermanfaat, salam 🙂

About the Author

Anshori Wahyu
My name is Mas Wahyu Anshori, 32 years old. I am a student from STIE Ahmad Dahlan Jakarta, work at Punakawan Digital Media since Oct 2017. Before I came to Punakawan, I was doing IT Supportt and web content at Seratus Company, Melodia Group and be part of Kehati as a freelance web developer. I was also a freelance web developer with simple HTML, CSS base, jQuery, and PHP. Learned Website Developer base (with a help of Google) by myself would be my achievement so far. I'am an Indonesian football junkie, as well as addicted to HTML, CSS and jQuery coding.

Be the first to comment on "Warning: Invalid argument supplied for foreach() di PHP"

Leave a Reply