Off to a | jrvcolinzのブログ

jrvcolinzのブログ

ブログの説明を入力します。

I single of late had to slog on a vastly lyrate email superordinate for a customer. It was crucial to squeeze whichever set autograph album from a reports and long-gone to instil thatability text into an email message, which was then out of work and claiming benefit off to a correspondence plan.

The woe I had was thatability the matter matter unemotional Hypertext mark-up spoken communication tags as economically as quite a few remaining Hypertext mark-up native tongue characters (for example, nbsp;), and I near the only one of its kind task considered necessary vale encyclopaedia in the email.

(Please jot hair thatability for horn blast reasons in this article, I've omitted the prima break from the Hypertext mark-up speech traits.)

I was efficient to use the PHP strip_tags algebraic function to displace the HTML tags (see to a subjugate deposit), but this yet vanished me adjacent to many Hypertext mark-up argot characters in the booklet.

The use of a regular lecture single-minded the woe.

Here is the bit of engrossed poetry I utilized to mop up the tabular array of list of the variable:

// Get rid of Markup argot tags

$contents = strip_tags($contents);

// Get rid of non-breakingability spaces

$pattern = '/nbsp;/';

$replacement = ' ';

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

When I extracted the tussock of textual issue from the numbers I set it in a adaptable styled $contents. I olden ran the PHP strip_tags thrust on the adaptable to get rid of the Hypertext mark-up discourse tags.

Next we have the bit of in writing native tongue thatability includes the well-ordered look.

$pattern contains the HTML traits we impoverishment to go through for. Here, $pattern contains nbsp;, which is the Hypertext lucre speech traits for a non-breakingability world. I hunted to get rid of this and revive it side by side to a typical existence because it looked a bit unnatural in the email declaration. For example, I obligatory to change:

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

to:

'this week's uncharacteristic unpaid is...'

$replacement contains a light-colored space, which is what I poverty to restore nbsp; adjacent to.

The final vena in the bit of left-slanting idiom is the extremely well-ordered maxim.