Follows not returning array of followers

<?php    
class Follows {
    public $_total, $next_link, $self_link, $follows;

    public function __construct($_total, $_links, $follows){
        $this->_total = $_total;
        $this->next_link = $_links['next'];
        $this->self_link = $_links['self'];

        if (is_array($follows)) {
            $follow_list = array();

            foreach ($follows as $value) {
                require_once(dirname(__FILE__) . '/Follow.php');
                array_push($follow_list, new Follow($value['created_at'], $value['_links'], $value['notifications'], $value['user']));
            }

            $this->follows = $follow_list;
        } else {
            $this->follows = $follows;
        }

    }
}

You are assigning $this->$follows instead of $this->follows I can’t see anything else wrong and I don’t have time to test your code properly right now

1 Like