Best practices for check result in ActiveRecord: count($models) or $models!==null

Hello:




$m = Post::find(1);

if(count($m))

{

   //do something

}



VS




$m = Post::find(1);

if($m!==null)

{

   //do something

}



Which is best/safest?




$m = Post::findOne(1);

if($m)

{

   //do something

}



Patrick Jones is correct. It’s the simplest check possible.