Code: Select all
$counter = 0;
$string = "Best niet [b]bevet [b]Moddervet[/b] Niet vet";
echo $string, "<br>";
ereg("\[b\]", $string, $resultaat);
echo var_dump($resultaat), "<br><br>";
foreach ($resultaat as $value) {
$counter++;
???echo $counter, "<br>";
???echo $value, "<br>";
}
Code: Select all
Best niet [b]bevet [b]Moddervet[/b] Niet vet
array(1) { [0]=> string(3) "[b]" }
1
[b]
Edit: Oops, got it. Had to put the regex between brackets, apparently.