PHP - 我如何能够保存此var转储数组的每个值?

时间:2011-07-13 03:20:44

标签: php

网站:http://shawn.sc2broadcast.net/test/

代码:

<?php
$homepage = file_get_contents('http://www.macsiam.com/sites.php');
preg_match_all('%\'http://([^./]+).[^.]+\.[a-z]{2,4}\'%i', $homepage, $domains, PREG_PATTERN_ORDER);
// $domains[0] is an array of matched full URLs (http://whatever.wherever.com/page.php)
// $domains[1] is an array of matched subdomains (whatever)

var_dump($domains[1]);
?>

问题:我想知道如何能够单独保存这个数组的每个值?

1 个答案:

答案 0 :(得分:0)

    foreach ( $domains as $domain ) {
         //balah balah
    }