world!");]."/> world!");].">
Home >Backend Development >PHP Problem >How to remove i tag in php
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!");].
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:
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!