Skip to content
Advertisement

array_push() expects parameter 1 to be array, int given

I am getting array_push() expect parameter one to be an array, any solution?

JavaScript

Advertisement

Answer

you have referenced the variable as an array first time. but when you are using it for array push with $activeCourses = it becomes an integer field as array_push returns an integer value and then when it comes to next array push in the next iteration, your activeCourses variable is no longer an array. so use like

JavaScript

or

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement