registerPhpFunctions(["cycle" => array($this, "dummy")]); } public function dummy(string $var) { return "dummy: $var"; } } function createProcessor($inputs, $class = "XSLTProcessor") { $xsl = new DomDocument(); $xsl->loadXML(' ' . implode('', array_map(fn($input) => '', $inputs)) . ' '); $proc = new $class(); $proc->importStylesheet($xsl); return $proc; }