A find method on a Product class
Use indexes on products

class Product {

    private static $products = [];

    public static function initialize($url)
    {
        // Build the product from our JSON file
        $data = json_decode(file_get_contents($url));
        foreach($data as $item) { 
            $product = new Product();
            $product-&gt;id = $item-&gt;id;
            $product-&gt;description = $item-&gt;description;
            $product-&gt;category = $item-&gt;category;
            $product-&gt;price = $item-&gt;price;

          self::$products[$product-&gt;id] = $product;
        }
    }

    public static function find($id)
    {
        if(isset(self::$products[$id])) {
            return self::$products[$id];
        }

        return false;
    }
}