How search the output only -
if any DOM as below?
<p>-</p>
<p><span style="font-size: medium;">-</span></p>
- etc.
Currently I just use the codes as below to find this output -
:
$input = `<p>-</p>`;
if($input == `<p>-</p>`):
return true;
else:
return false;
endif;
Any better ideas?
The accepted answer would not work for special cases like if the tag attribute values contains
>-<
or if-
is not wrapped within the tags:Instead you could use
strip_tags()
, which is not as efficient asstrpos()
but would work for all cases: