PHP 8.3.4 Released!

xml_set_processing_instruction_handler

(PHP 4, PHP 5, PHP 7, PHP 8)

xml_set_processing_instruction_handler Set up processing instruction (PI) handler

Descrição

xml_set_processing_instruction_handler(XMLParser $parser, callable $handler): true

Sets the processing instruction (PI) handler function for the XML parser parser.

A processing instruction has the following format:

<?target
data
?>

Cuidado

PHP code is delimited by the <?php processing instruction. As such it is possible to have PHP code within an XML document. However, the PI end tag (?>) must not be part of the data. If a PI end tag exists as part of the embedded PHP code, the rest of the PHP code and the "real" PI end tag, will be treated as character data.

Parâmetros

parser

O analisador XML.

handler

Se null ou uma string vazia for passada, o manipulador será redefinido para seu estado padrão.

Se handler for um callable, o callable será definido como o manipulador.

Se handler for uma string, ela pode ser o nome de um método de um objet definido com xml_set_object().

The signature of the handler must be:

handler(XMLParser $parser, string $target, string $data): void
parser
O analisador XML que chama o manipulador.
target
The processing instruction target.
data
The processing instruction data.

Valor Retornado

Sempre retorna true.

Registro de Alterações

Versão Descrição
8.0.0 O parâmetro parser agora espera uma instância de XMLParser; anteriormente, um resource xml válido era esperado.
add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top