|
Posted by Justin Koivisto on 01/12/06 22:53
Al wrote:
> I just tested this and i get fieldset not closed for all 3 cases
> (fieldset works properly, no fieldset was used at all and fieldset not
> closed)
Really?? Here's what I get:
<?php
$str=array();
$str[]=<<<EOS
<fieldset>
<legend> Bob </legend>
<div class="quote">Hello there</div>
</fieldset>
EOS;
$str[]=<<<EOS
<fieldset>
<legend> Bob </legend>
<div class="quote">Hello there</div>
EOS;
$str[]=<<<EOS
<legend> Bob </legend>
<div class="quote">Hello there</div>
EOS;
$pattern='`<fieldset>.*</fieldset>`isU';
foreach($str as $html){
echo $html,"---\n";
if(preg_match($pattern,$html)){
// fieldset is closed
echo 'fieldset closed',"\n\n";
}else{
// fieldset set is *not* closed
echo 'fieldset not closed',"\n\n";
}
}
?>
Result:
<fieldset>
<legend> Bob </legend>
<div class="quote">Hello there</div>
</fieldset>
---
fieldset closed
<fieldset>
<legend> Bob </legend>
<div class="quote">Hello there</div>
---
fieldset not closed
<legend> Bob </legend>
<div class="quote">Hello there</div>
---
fieldset not closed
--
Justin Koivisto, ZCE - justin@koivi.com
http://koivi.com
Navigation:
[Reply to this message]
|