hiphop-php /hphp/test/slow/control-flow/loop-srckey.php

Language PHP Lines 18
MD5 Hash 4e512ef416b0761a4f3e3eabebed3ebf Estimated Cost $306 (why?)
Repository git://github.com/facebook/hiphop-php.git View Raw File View Project SPDX
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
<?hh


function subdomains($domain) {
  $domains = array();
  $components = explode('.', strtolower($domain));
  while (count($components) > 0) {
    $domains[] = implode('.', $components);
    array_shift($components);
  }
  return $domains;
}

$domains = array_fill(0, 22, 'www.facebook');
foreach ($domains as $d) {
  var_dump(subdomains($d));
}
Back to Top