3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $tags = ' #vienna #wien #austria #view #travel #sky #holiday #vacation #ig_europe #landmark #reflections #ocean #europe #sky #reflection #water #people #sea #pretty #fun #beach #lighthouse #cliff #topeuropephotos #photo #photos #cloud #stone #sunset ' ; $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(22) "tag already found: sky" string(13) "found 29 tags"