3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $data = "<p>He ran towards jungle like a mad man.</p> <p>He ran away.</p> <table> <tbody> <tr><th>Name</th></tr> <tr><td>Moodle</td></tr> <tr><td>Dspace</td></tr> </tbody></table>"; $words = preg_split("/[\n\r\t ]+/", $data,0, PREG_SPLIT_NO_EMPTY); var_dump($words); $words1 = explode(" ", $data); var_dump($words1);
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
array(17) { [0]=> string(5) "<p>He" [1]=> string(3) "ran" [2]=> string(7) "towards" [3]=> string(6) "jungle" [4]=> string(4) "like" [5]=> string(1) "a" [6]=> string(3) "mad" [7]=> string(8) "man.</p>" [8]=> string(5) "<p>He" [9]=> string(3) "ran" [10]=> string(9) "away.</p>" [11]=> string(7) "<table>" [12]=> string(7) "<tbody>" [13]=> string(22) "<tr><th>Name</th></tr>" [14]=> string(24) "<tr><td>Moodle</td></tr>" [15]=> string(24) "<tr><td>Dspace</td></tr>" [16]=> string(16) "</tbody></table>" } array(10) { [0]=> string(5) "<p>He" [1]=> string(3) "ran" [2]=> string(7) "towards" [3]=> string(6) "jungle" [4]=> string(4) "like" [5]=> string(1) "a" [6]=> string(3) "mad" [7]=> string(14) "man.</p> <p>He" [8]=> string(3) "ran" [9]=> string(115) "away.</p> <table> <tbody> <tr><th>Name</th></tr> <tr><td>Moodle</td></tr> <tr><td>Dspace</td></tr> </tbody></table>" }