I have the following code:
<?php
$content = '
text text text text <img src="path/to/image/1">text text text text
<img src="path/to/image/2">
text text text text text text text text text text text text text text text text <img src="path/to/image/3"><img src$
<img src="path/to/image/5"> ';
$frst_image = preg_match_all( '|<img.*?src=[\'"](.*?)[\'"].*?>|i', $content, $matches );
print_r($matches[0]);
It is returning:
Array
(
[0] => <img src="path/to/image/1">
[1] => <img src="path/to/image/2">
[2] => <img src="path/to/image/3">
[3] => <img src="path/to/image/4">
[4] => <img src="path/to/image/5">
)
However, I want to return only content contained within src , how do I do this?