Backend Development

Error with class array

Submitted by bVnDBsapg, , Thread ID: 97384

Thread Closed

RE: Error with class array

Jarinity
Novice
Level:
0
Reputation:
1
Posts:
23
Likes:
0
Credits:
8
11-08-2018, 06:38 AM
#2
I believe your error will be within the LoadPosts function. I believe you can only store stdObject and instantiated objects within an array.

I quick tip, I would be using a foreach loop to loop through the objects and not an iterator like you've got, i.e.

Code:
$posts = array([objects]);

foreach($posts as $key=>$post_object){

       $post_object->object_function();
       $posts[$key][change something in the original array] = [];

}

Users browsing this thread: 1 Guest(s)