Skip to content
Advertisement

How to call function from object stored in array in PHP?

I can’t call / access the Id function from Product class which is stored in $products array in the foreach loop. ($product->Id())

I have tried

JavaScript
JavaScript

Advertisement

Answer

You misspelled

public function __contruct($id)

Change it to :

public function __construct($id)

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement