[ create a new paste ] login | about

Link: http://codepad.org/cIzTWlGF    [ raw code | output | fork ]

PHP, pasted on Sep 1:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php

$string = '<strong>bold <br /><br /> text</strong><br /><br /><br />
<a href="#">link</a><br /><br />
<pre>some code</pre>
<br /> I\'m a single br, leave me alone.';

$string = explode('<br />', $string);

foreach ($string as $key => $val)
{
    if ( ! $val ) unset($string[$key]);
}

$string = array_values($string);

echo implode('<br />', $string);


Output:
1
2
3
4
<strong>bold <br /> text</strong><br />
<a href="#">link</a><br />
<pre>some code</pre>
<br /> I'm a single br, leave me alone.


Create a new paste based on this one


Comments: