http://Bj83.de

nach patterns suchen mit preg_match

mit pregmatch und regular expression

<?php
function dump($val){
	print "<pre>"; 
	print_r($val);
	print "</pre>";	
}

$val = 'e!w|e2!w2|e3!w3|e4!w4|';
//preg_match_all('(\|(.+?)\|)', $val, $placeholders);
preg_match_all('((.+?)\|)', $val, $placeholders);
dump($placeholders);
$matches = array();
foreach ($placeholders[1] as $mk => $match) {
	echo $mk . ' - ' . $match . '<br>';
	if(false===array_search($match, $matches)){
		$matches[] = $match;
	}
}
dump($matches);
?>

Leave a Reply

Your email address will not be published. Required fields are marked *

Follow

Get every new post on this blog delivered to your Inbox.

Join other followers: