0

I know this is very simple and easy, but I am new to wordpress, php, and js.

$classes = array();
array_push($classes, $match);
foreach($classes as $names => $text ) {

preg_match('/<strong class="'.$text.'">(.*?)<\/strong>/s', $sample, $match);
preg_match('/<p class="'.$text.'">(.*?)<\/p>/s', $sample, $match);

echo $match[1];

I want to get the values of $match, which which is declared at the bottom and use it as the values of $classes, which is declared at the top. Because I want the $text variable work at the bottom. I hope I am clear enough.

  • In another word, I want to get the number of times $match[1] will echo and use it as the length of $classes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.