How to remove i tag in php

王林
Release: 2023-03-10 17:52:01
Original
2058 people have browsed it

The way to remove the i tag in php is to use the strip_tags function in the php code and take the code with the i tag as a parameter, for example [strip_tags("Hello world!");].

How to remove i tag in php

The operating environment of this article: windows10 system, php 7.3, thinkpad t480 computer.

We may need to remove certain HTML tags at work, such as i tags, b tags, etc. So how do we remove these HTML tags?

In fact, it is very simple to remove HTML tags, because PHP itself has provided us with existing functions, such as the strip_tags function. Let us introduce the strip_tags function below.

strip_tags() function is used to strip HTML, XML and PHP tags from strings.

The syntax is as follows:

strip_tags(string,allow)
Copy after login

The parameters are explained as follows:

  • string Required. Specifies the string to check.

  • #allow Optional. Specifies allowed tags. These tags will not be deleted.

Code example:

<!DOCTYPE html>
<html>
<body>

<?php
echo strip_tags("Hello <b>world!</b>");
?>

<p>This function strips a string from HTML, XML, and PHP tags. In this example, the <b> tag gets stripped.</p>

</body>
</html>
Copy after login

Let’s take a look at the running effect:

How to remove i tag in php

Related recommendations : php video tutorial

The above is the detailed content of How to remove i tag in php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!