3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $message = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus sodales magna pellentesque, lobortis velit eget, suscipit augue. Sed tempus nisi massa, et aliquet metus tempor a. In auctor ante ut tellus luctus auctor. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Quisque mollis ornare nunc, sit amet venenatis eros condimentum in. Praesent consequat erat id vulputate vulputate. Fusce egestas luctus mi vitae dapibus. Nam varius imperdiet felis eget porttitor. In ac cursus ipsum. Interdum et malesuada fames ac ante ipsum primis in faucibus. Nunc auctor viverra nisl non dignissim. Vestibulum auctor molestie tellus, aliquet consectetur dui posuere et. Morbi non risus vel est mattis rhoncus. In odio leo, aliquet ut felis eget, aliquam condimentum diam. In laoreet dignissim est, vitae sollicitudin ante mollis sed."; $words = preg_split('/\s+/', $message); $words = array_slice($words, 0, 50); $sentence; //var_dump($words); foreach($words as $word) { $sentence += $word . " "; } echo $sentence; ?>
Output for 7.1.0
Notice: Undefined variable: sentence in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 Warning: A non-numeric value encountered in /in/VU2Fl on line 14 0
Output for 5.1.0 - 7.0.14
Notice: Undefined variable: sentence in /in/VU2Fl on line 14 0
Output for 5.0.4 - 5.0.5
Notice: Undefined variable: sentence in /in/VU2Fl on line 9 Notice: Undefined variable: sentence in /in/VU2Fl on line 14 0
Output for 4.3.0 - 5.0.3
Notice: Undefined variable: sentence in /in/VU2Fl on line 9 Notice: Undefined variable: sentence in /in/VU2Fl on line 14 0