I am trying to get length of images in a string.
My string
$page="<img><img><img><img>";
From the string above ,I want to get the output "4 images".
I tried preg_match_all()
and count()
function, but it always returns "1 images".
$page="<img><img><img><img>";
preg_match_all("/<img>/",$page,$m);
echo count($m);
Is there any other way to know how much images are in a string?
substr_count()
– Alkane