<?php
class Classe {
public $exemplo = [];
public function add($parametro1, $parametro2){
$this->exemplo['parametro1'] = $parametro1;
$this->exemplo['parametro2'] = $parametro2;
}
}
$classe = new Classe;
$classe->add('parâmetro 1 aqui', function() { return 'retorno da função anonima para o parâmetro 2'; });
echo $classe->exemplo['parametro2']();
//https://pt.stackoverflow.com/q/99545/101
PD9waHAKY2xhc3MgQ2xhc3NlIHsKICAgIHB1YmxpYyAkZXhlbXBsbyA9IFtdOwogICAgcHVibGljIGZ1bmN0aW9uIGFkZCgkcGFyYW1ldHJvMSwgJHBhcmFtZXRybzIpewogICAgICAgICR0aGlzLT5leGVtcGxvWydwYXJhbWV0cm8xJ10gPSAkcGFyYW1ldHJvMTsKICAgICAgICAkdGhpcy0+ZXhlbXBsb1sncGFyYW1ldHJvMiddID0gJHBhcmFtZXRybzI7CiAgICB9Cn0KJGNsYXNzZSA9IG5ldyBDbGFzc2U7CiRjbGFzc2UtPmFkZCgncGFyw6JtZXRybyAxIGFxdWknLCBmdW5jdGlvbigpIHsgcmV0dXJuICdyZXRvcm5vIGRhIGZ1bsOnw6NvIGFub25pbWEgcGFyYSBvIHBhcsOibWV0cm8gMic7IH0pOwplY2hvICRjbGFzc2UtPmV4ZW1wbG9bJ3BhcmFtZXRybzInXSgpOwoKLy9odHRwczovL3B0LnN0YWNrb3ZlcmZsb3cuY29tL3EvOTk1NDUvMTAx