I know I could do this by iteration but I am curious if there is a builtin function to achieve this task.
>Solution :
Assuming you have a non-empty array of objects $objects_array all having the property $property_name, you should perform this test:
count(array_unique(array_column($objects_array, $property_name))) === 1