3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input ="we are the people who are selected by the people of country who gave vote."; $words = array_count_values(explode(' ', strtolower($input))); $first_occ = ''; foreach ($words as $word => $count) { if ($count > 1) { $first_occ = $word; break; } } echo $first_occ;

preferences:
26.6 ms | 406 KiB | 5 Q