PHP – count an object returns 1

While I was trying to use count to see the number of elements on a object,
PHP count was returning me 1.

This is how I solved it.

$total = count((array)$objecto);

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.