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

http://github.com/facebook/hiphop-php · PHP · 21 lines · 17 code · 4 blank · 0 comment · 1 complexity · 61f4f781fa813cbfb87a3c540d1776d1 MD5 · raw file

  1. <?hh
  2. function subdomains($domain) {
  3. $domains = varray[];
  4. $components = explode('.', strtolower($domain));
  5. while (count($components) > 0) {
  6. $domains[] = implode('.', $components);
  7. array_shift(inout $components);
  8. }
  9. return $domains;
  10. }
  11. <<__EntryPoint>>
  12. function main_loop_srckey() {
  13. $domains = array_fill(0, 22, 'www.facebook');
  14. foreach ($domains as $d) {
  15. var_dump(subdomains($d));
  16. }
  17. }