Thursday, November 1, 2012

explode() is not working to explode with "br" tag


I am trying to explode "<br>" tag but its not working.My string is below

 3013 Bates Lake Road <br>
 Macolm, AL 36566

*************My PHP Code ******************

$string="3013 Bates Lake Road Macolm, AL 36566";

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

print_r($array_string);

****************Result*******************

Array ( [0] => 3013 Bates Lake Road Macolm, AL 36566 )

*****************************************

*****Use <br/> insted of <br> try this it will given you expected result******

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

 print_r($array_string);

****************Result*******************

Array ( [0] => 3013 Bates Lake Road
            [1] => Macolm, AL 36566
           )

*****************************************

Happy coding :) 
Related Posts Plugin for WordPress, Blogger...