Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $categoryList = array();
- function createBlogPosts($posts) {
- $np = array();
- for($i = count($posts) - 1; $i >= 0; $i--) {
- $bp = new BlogPost;
- $bp->read($posts[$i]);
- $hasFoundCat = False;
- foreach($categoryList as $c) {
- if($bp->category == $c) {
- $hasFoundCat = True;
- break;
- }
- }
- if(!$hasFoundCat) {
- array_push($categoryList, $bp->category);
- }
- array_push($np, $bp);
- }
- return $np;
- }
Advertisement
Add Comment
Please, Sign In to add comment