tokam tokam - 6 months ago 45
PHP Question

strip_tags() .... replace tags by space rather than deleting them

Do you know how to replace html tags with a space character using php?

If I display


I get as result "foobar" but what I need to keep words separate is "foo bar".


Try this.

preg_replace('#<[^>]+>#', ' ', '<h1>Foo</h1>bar');