I have this little PHP code:
<?php
$r = file("id.txt");
$content = implode(" ",$r);
if (preg_match('#"name":[^"]*"([^"]*)"#', $content, $datos)) {
$mp = $datos[1];
} else {
$mp = 'error';
}
echo $mp;
?>
That is responsible for opening and searching using preg_match () the content of
"name":"contenido"
with the help of regular expressions inside the "id.txt" file.
Content of "id.txt":
"name":"jose";
"name":"juan";
"name":"carlos";
"name":"luis";
There are more than 50 lines what it contains
"name":""
with different names.
Everything goes well. The detail is that it only gives me the first name and what I want is to get all the names and store them in a variable.