title: How array_filter is returning an object
body: <p>I was following a tutorial and came across this,let's say I'm having an array of posts(<strong>objects</strong>) having two properties: </p>
  
  <p>title of the post and the status (is it published or not). <br>
  and in my code I want to return those posts who are not published yet. 
  I know there are various ways to do that but in the tutorial the code shown was like this</p>
  
  <pre class="lang-php prettyprint-override"><code>$posts = [
      new Post("My First Post",false),
      new Post("My Second Post",true),
      new Post("My Third Post",false),
      new Post("My Fourth Post",false),
      new Post("My Fifth Post",true),
      ];
  
  
  $unpulishedPost = array_filter( $posts,function ($post){
      return !$post-&gt;published;
  });
  </code></pre>
  
  <p>I can't get my head around how does return actually returns the entire post object when it should only returns an array of booleans shouldn't the code be like so </p>
  
  <pre class="lang-php prettyprint-override"><code>$unpulishedPost = array_filter( $posts,function ($post){
       if(!$post-&gt;published) 
       return $post;
  });
  </code></pre>