Dom\TokenList::remove
PHP function
Edit on GitHub ✎
(PHP 8 >= 8.4.0)
Removes the given tokens from the list
Description
Dom\TokenList::remove(string ...$tokens): void
Removes the given tokens from the list, but ignores any that were not present.
Parameters
tokensThe tokens to remove.
Return Values
Void
Errors/Exceptions Errors
Examples
Dom\TokenList::remove example
Removes two classes from the paragraph.
php
<?php
$dom = Dom\HTMLDocument::createFromString('<p class="font-bold important"></p>', LIBXML_NOERROR);
$p = $dom->body->firstChild;
$p->classList->remove('font-bold', 'important');
echo $dom->saveHtml($p);
?>The above example will output:
output
<p class=""></p>