/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
- <?hh
- function subdomains($domain) {
- $domains = varray[];
- $components = explode('.', strtolower($domain));
- while (count($components) > 0) {
- $domains[] = implode('.', $components);
- array_shift(inout $components);
- }
- return $domains;
- }
- <<__EntryPoint>>
- function main_loop_srckey() {
- $domains = array_fill(0, 22, 'www.facebook');
- foreach ($domains as $d) {
- var_dump(subdomains($d));
- }
- }