I think you don’t realy get the way PHP is handling objects and arrays.
As kingkero said, the proper way to access your buttons by “id” is
$page['button']['Your id']
As so, you will have to change function that you use to create the actual button.
You could create an object that is callable the way you want, but it will be pretty hacky and unlogic.
Keep things simple, just pass the proper array entry to the creation method.
KISS.
solved how to call array index in php [closed]