How to use a variable as a className inside preg_match_all parameters?
I am using regular expression to get the text inside a single p tag targeting its class. the problem is I want to use a php variable as class name and use a loop to change the class name each time.
$sample = get_the_content(); <button class="accordion"> preg_match('/<strong class="1">(.*?)</strong>/s', $sample, $match); echo $match; $className = "1";
I want to use the $classname varialbe up there and increment it in a loop to get different paragraph content each time.
I hope I am clear in my question.