[Solved] I need to get the corresponding number after * in the string


Hi is the number still part of the string ? if does, maybe you can use explode.

<?php
  $num = "* 2 * 3 * 5";
  print_r (explode("*",$str));
?>

I hope it helped you. 🙂

——-UPDATED—————–

$str="first string * 2 + second string * 4 + third string * 9";
preg_match_all('!\d+!', $str, $matches);
print_r($matches);

5

solved I need to get the corresponding number after * in the string