world!");]."/> world!");].">

Home  >  Article  >  Backend Development  >  How to remove i tag in php

How to remove i tag in php

王林
王林Original
2021-06-18 13:53:292066browse

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)

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>

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!

Statement:
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