(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
Returns the number of errors encountered in the configuration of the
specified tidy tidy.
Returns the number of errors.
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