2
に、アレイからの正規表現の結果を保存するためのI次の正規表現があります。はどのように非多次元配列
$regex = '/https?\:\/\/[^(\"|\\\) ]+/i';
for ($i = 0; $i < count($column7); ++$i)
{
preg_match_all($regex, $column7[$i], $matches[$i]);
print_r($matches[$i]);
}
列7は、多くの異なる文字列で構成された配列です。私はすべてのURLを一致させ、$ matchesという単一の配列に格納して、以下の例のように各要素からのすべての一致を1つの配列に格納したいと考えています。
Array
(
[0] => https://domain.comf3aeaf
[1] => https://ureasdjlkfjasldkf.com
[2] => http://heelooo.com
[3] => https://www.asdfasdfasd.com
[4] => https://asdfafrgasrgas.com
[5] => http://rgtfgsdagf.com
[6] => http://asfgdfhgasdgafsd.com
[7] => http://asdghdthgaterge.com
[8] => https://asdgsdhdsthaerararrrr.com
[9] => https://t.com
[10] => http://abc.cmo
)
私はちょうど自分自身を上書き多次元配列を得るように見えるprint_r($matches[$i])
。どのようにすれば、すべてのURLを順番に1次元配列にすることができますか?
私はそれが理にかなって願っています!私は取得しています
実際の出力:
Array
(
[0] => Array
(
[0] => https://domain.comf3aeaf
[1] => https://ureasdjlkfjasldkf.com
[2] => http://heelooo.com
)
)
Array
(
[0] => Array
(
[0] => https://www.asdfasdfasd.com
[1] => https://asdfafrgasrgas.com
[2] => http://rgtfgsdagf.com
[3] => http://asfgdfhgasdgafsd.com
[4] => http://asdghdthgaterge.com
)
)
Array
(
[0] => Array
(
[0] => https://asdgsdhdsthaerararrrr.com
[1] => https://t.com
[2] => http://abc.cmo
)
)