Quick Snippet to Verify All Object Properties are Not Empty
This post is more than 18 months old. Technology changes quickly, so some of this content may be out of date (but that's not always the case). Please verify any technical or programming information against the current release.
If you check out array_filter without a callback, you’ll notice that it will basically check each array key to make sure it doesn’t equal false. If you have an object, you get call of the properties as an array using get_object_vars. This quick snippet will allow you to look at an object and verify each property is non-false (or non-empty).
if (array_filter(get_object_vars($object)) == get_object_vars($object)) {
// each property is non-empty
}php
Simple and sometimes useful.