Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/styllloz/public_html/qa-include/qa-base.php on line 1175

Warning: session_start(): Cannot start session when headers already sent in /home/styllloz/public_html/qa-include/app/users.php on line 162

Warning: Cannot modify header information - headers already sent by (output started at /home/styllloz/public_html/qa-include/qa-base.php:1175) in /home/styllloz/public_html/qa-include/app/users.php on line 1267

Warning: Cannot modify header information - headers already sent by (output started at /home/styllloz/public_html/qa-include/qa-base.php:1175) in /home/styllloz/public_html/qa-include/app/page.php on line 356
Deletion of some text using PHP - code-flow.club | Q&A

Deletion of some text using PHP


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
26 views
I'll note that I'm still a novice to PHP.

For example, there is a link:

Link

How to remove?

 title="Title"
by | 26 views

4 Answers

0 like 0 dislike
With qJerry you can work with XML in PHP is as easy as jQuery in JavaScript with HTML.
\r
Here's the code:
q('Link')->removeAttr('title')->dump(); 
outputs:
<?xml version="1.0"?>\rLink
by
0 like 0 dislike
Something like that, not tested, but should work:
\r
str_replace('Link','Link',$Text);
by
0 like 0 dislike
Put the engine to work with the DOM as described above. Another alternative is to use JS, just not quite sure if it's appropriate in Your case (JS will work after the formation of the source).
by
0 like 0 dislike
People, and there is an html parser, it on habré used... There you can specify allowed tags and attributes. What is it called?
by
110,608 questions
257,186 answers
0 comments
35,181 users