close

I only just had to work on a vastly unsubdivided email supervisor for a shopper. It was necessary to wring whichever set book from a information and past to instil thatability record into an email message, which was past unemployed off to a mail schedule.

The woe I had was thatability the textual matter restrained Hypertext mark-up language tags as well as some other Hypertext mark-up language characters (for example, nbsp;), and I with the sole purpose wanted valley manual in the email.

(Please write down thatability for trumpet blast reasons in this article, I've omitted the stellar punctuation from the Hypertext mark-up language traits.)

I was competent to use the PHP strip_tags mathematical function to uproot the HTML tags (see to a lower place), but this yet vanished me next to various Hypertext mark-up language characters in the manual.

The use of a well-ordered outburst resolved the woe.

Here is the bit of written language I utilized to mop up the table of contents of the variable:

// Get rid of Markup language tags

$contents = strip_tags($contents);

// Get rid of non-breakingability spaces

$pattern = '/nbsp;/';

$replacement = ' ';

$contents = preg_replace($pattern, $replacement, $contents);

When I extracted the wisp of textual matter from the information I settled it in a versatile titled $contents. I past ran the PHP strip_tags drive on the versatile to get rid of the Hypertext mark-up language tags.

Next we have the bit of written language thatability includes the well-ordered look.

$pattern contains the HTML traits we privation to search for. Here, $pattern contains nbsp;, which is the Hypertext markup language traits for a non-breakingability universe. I required to get rid of this and renew it next to a normal universe because it looked a bit eerie in the email statement. For example, I required to change:

'thisnbsp;week'snbsp;specialnbsp;offernbsp;is...'

to:

'this week's unusual volunteer is...'

$replacement contains a white space, which is what I privation to renew nbsp; next to.

The ultimate vein in the bit of written language is the very well-ordered axiom.

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 ktraymundo 的頭像
    ktraymundo

    ktraymundo的部落格

    ktraymundo 發表在 痞客邦 留言(0) 人氣()