3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $tags = ' #portugal #sagres #cabodesaovicente #love #travel #couple #holiday #vacation #ig_europe #landmark #reflections #ocean #europe #sky #reflection #water #people #sea #view #fun #igdaily #house #village #topeuropephotos #photo #photos #cloud #stone #palace ' ; $pcs = array_map('trim', explode('#', $tags)); $found=[]; foreach($pcs as $piece){ if (array_key_exists($piece, $found)){ var_dump("tag already found: $piece"); continue; } $found[$piece]=true; } var_dump("found ".count($found)." tags");
Output for 7.3.0rc3
string(13) "found 30 tags"