phpday 2027 - Call for Papers

tidy_config_count

(PHP 5, PHP 7, PHP 8, PECL tidy >= 0.5.2)

tidy_config_count — Returns the Number of Tidy configuration errors encountered for specified document

Description

function tidy_config_count(tidy $tidy): int

Returns the number of errors encountered in the configuration of the specified tidy tidy.

Parameters

tidy

The Tidy object.

Return Values

Returns the number of errors.

Examples

Example #1 tidy_config_count() example

<?php
$html = '<p>test</I>';

// Invalid values in a configuration array throw a TypeError as of PHP 8.5.0,
// so the invalid value is read from a configuration file
$configFile = tempnam(sys_get_temp_dir(), 'tidy');
file_put_contents($configFile, "wrap: abc\n");

$tidy = tidy_parse_string($html, $configFile);

/* This outputs 1, because 'abc' isn't a valid wrap value */
echo tidy_config_count($tidy);

unlink($configFile);
?>

The above example will output something similar to:

Notice: tidy_parse_string(): There were errors while parsing the Tidy configuration file "/tmp/tidyAbC123" in %s on line %d
1

See Also

User Contributed Notes

There are no user contributed notes for this page.
Adding new notes is disabled. Please see the links in the Found A Problem? section.
To Top