PHP-php Tutorial

Source: Internet
Author: User
This article mainly introduces how to delete the width and height styles in the HTML code using PHP regular expressions, and involves php's operations on HTML code such as regular matching and replacement, for more information about how to delete the width and height styles in HTML code using PHP regular expressions, such as regular matching and replacement of HTML code, for more information, see

This article describes how to delete the width and height styles in HTML code using PHP regular expressions. We will share this with you for your reference. The details are as follows:

For work purposes, you need to collect html and save the html content to the database. To avoid impact on use, you must delete the width and height styles. Width and height in sample and p.

However, in the collected html, styles are written differently, such as case and space in the middle.

Therefore, the following method is compiled using php regular expressions to filter out these wonderful styles.

The code is as follows:


 

Demo:


   

HTML; echo' & #39; echo & #39; original content: & #39 ;. PHP_EOL; echo $ html. PHP_EOL.PHP_EOL; echo & #39; filtered content: & #39 ;. PHP_EOL; echo clear_wh ($ html); echo & #39; ';?>

Output:


Original content:

Filtered content:

The above is a detailed explanation of how PHP deletes the width and height styles in HTML. For more information, see other related articles in the first PHP community!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.