PHP 8.5.0 Alpha 1 available for testing

Voting

: min(six, six)?
(Example: nine)

The Note You're Voting On

unspammable-iain at iaindooley dot com
19 years ago
re: jason at omegavortex dot com below, another way to deal with whitespace issues is:

function charData($parser,$data)
{
$char_data = trim($data);

if($char_data)
$char_data = preg_replace('/ */',' ',$data);

$this->cdata .= $char_data;
}

This means that:

<p>here is my text <a href="something">my text</a>
and here is some more after some spaces at the
beginning of the line</p>

comes out properly. You could do further replacements if you want to deal with tabs in your files. i only ever use spaces. if you only use trim() then you would lose the space before the <a> tag above, but trim() is a good way to check for completely empty char data, then just replace more than one space with a single space. this will preserve a single space at the beginning and end of the cdata.

<< Back to user notes page

To Top