<?php $objects = [ (object)['cats' => 2], (object)['dogs' => 2], (object)['fish' => 10], (object)['birds' => 1], ]; $needleField = 'cats'; $needleValue = 2; var_export( array_any( $objects, fn($obj) => property_exists($obj, $needleField) && $obj->$needleField === $needleValue ) );
You have javascript disabled. You will not be able to edit any code.