<?php
echo preg_replace('#(?:.(.))+#s', '$1', '.a.b.c');
?>
Any ideas?
Try focusing on the simple rules:
<?php
echo preg_replace('/[^A-Z]/i', NULL, '.a.b.c');
?>
Ouputs just what you need.
Best luck!
Vladimir
http://www.Vladimirated.com
Hi, If you know that the characters are dots, just str_replace them with
nothing
$new = str_replace('.','','.a.b.c');
or if they are every other character , regardless of value, try:
$string = '.d.fjdghdjtgkfdhfr';
$new = '';
for ($n = 2 to len($string)+1){
if ($n%2==0) $new .= substr($string,$n-2,1);
}
this will remove all the odd characters,
testing for $n modulus 2 ==1 will take out the even characters
HTH
Ron
Or, even simpler:
$new = '';
for($i = 1; $i < len($string); $i += 2)
$new .= $string[$i];