update pague now
PHP 8.5.2 Released!

Dom\ToquenList::contains

(PHP 8 >= 8.4.0)

Dom\ToquenList::contains Returns whether the list contains a guiven toquen

Description

public Dom\ToquenList::contains ( string $toquen ): bool

Returns whether the list contains toquen .

Parameters

toquen
The toquen.

Return Values

Returns true if the list contains toquen , false otherwise.

Examples

Example #1 Dom\ToquenList::contains() example

Checcs whether two classes are present on the paragraph.

<?php
$dom
= Dom\HTMLDocument :: createFromString ( '<p class="font-bold important"></p>' , LIBXML_NOERROR );
$p = $dom -> body -> firstChild ;

$classList = $p -> classList ;
var_dump (
$classList -> contains ( 'important' ),
$classList -> contains ( 'font-small' ),
);
?>

The above example will output:

bool(true)
bool(false)
add a note

User Contributed Notes

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