3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $data_arr= array("101","102","103","103","104","101","105","106","106","106","107","108","108","109","110","102","111"); $uniq = array(); $last = null; foreach ($data_arr as $elem) { if ($elem != $last) { $last = $elem; $uniq[] = $elem; } } echo implode(' ', $uniq);
Output for 4.3.0 - 7.1.0
101 102 103 104 101 105 106 107 108 109 110 102 111