Adnan
Adnan

Reputation: 35

PHP - Match two strings ignoring span tags

I am looking for a function that matches string A with string B (ignoring span tags)

a) Shopping for <span>Stylish</span> Rugs Area

b) Shopping for Stylish Rugs Area

Function should return TRUE if match is found else FALSE, so in above case it should return TRUE.

Thanks

Upvotes: 2

Views: 92

Answers (1)

Nauphal
Nauphal

Reputation: 6202

You can use strip_tags() to remove the tags from string.

$a  = 'Shopping for <span>Stylish</span> Rugs Area';
$b = 'Shopping for Stylish Rugs Area';
var_dump(strip_tags($a) == $b); // outputs true

Upvotes: 4

Related Questions