there is an array, there is text in it that contains links, and there is just text.
foreach ($arrayData['messages'] as $item) { if (preg_match('#^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$#i', $item['content'])) { $values[] = [date('Ymd H:i:s', $item['timestamp_ms'] / 1000), $item['sender_name'], $item['content'], isset($item['share']) ? $item['share']['link'] : null]; } } I want to pull the values of $ item ['content'] in which there is both a link and text.