3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $emailed = array('cam.hurd@gmail.com', 'jeremy@derp.com', 'boooooooooop', 'dlfjdflkj', 'cam.hurd@gmail.com', 'jeremy@derp.com', 'boooooooooop', 'dlfjdflkj','cam.hurd@gmail.com', 'jeremy@derp.com', 'boooooooooop', 'dlfjdflkj'); $message = (count($emailed) > 10) ? implode(array_slice($emailed, 0, 10), ', ') : (count($emailed) > 2) ? 'Invites sent to: ' . implode($emailed, ', ') . '.' : (count($emailed) == 2) ? implode($emailed, ' and ') . ' were invited' : $emailed[0] . ' was invited'; var_dump(array_slice($emailed, 0, 10)); echo $message;
Output for 4.3.0 - 7.1.0
array(10) { [0]=> string(18) "cam.hurd@gmail.com" [1]=> string(15) "jeremy@derp.com" [2]=> string(12) "boooooooooop" [3]=> string(9) "dlfjdflkj" [4]=> string(18) "cam.hurd@gmail.com" [5]=> string(15) "jeremy@derp.com" [6]=> string(12) "boooooooooop" [7]=> string(9) "dlfjdflkj" [8]=> string(18) "cam.hurd@gmail.com" [9]=> string(15) "jeremy@derp.com" } cam.hurd@gmail.com and jeremy@derp.com and boooooooooop and dlfjdflkj and cam.hurd@gmail.com and jeremy@derp.com and boooooooooop and dlfjdflkj and cam.hurd@gmail.com and jeremy@derp.com and boooooooooop and dlfjdflkj were invited