3v4l.org

run code in 300+ PHP versions simultaneously
<?php function isSocial($url){ $patDom=array("(\.|https*\:\/\/)facebook\.[a-z]+\/","(\.|https*\:\/\/)twitter\.[a-z]+\/","(\.|https*\:\/\/)plus\.*google\.[a-z]+\/","(\.|https*\:\/\/)linkedin\.[a-z]+\/","(\.|https*\:\/\/)instagram\.[a-z]+\/","(\.|https*\:\/\/)myspcae\.[a-z]+\/","(\.|https*\:\/\/)pinterest\.[a-z]+\/"); foreach($patDom as $pat){ if(preg_match("/$pat/i",$url))return true; } return false; } $urls=array("http://profile.facebook.com/hedayat.yazdani","http://plug.google.com/image/24","http://www.twitter.net/image/24","http://jointab.com"); foreach($urls as $key=>$value){ echo "$key - $value => is".(isSocial($value)?" ":" [not] ")."social network page\n"; }

preferences:
52.45 ms | 402 KiB | 5 Q