i have the folowing code that gives me the first letter of each word.

$string = $rowec['doopnamen'];
                    $punt =".";
$words = explode(" ", $string);
$doopnamen = " ";
foreach ($words as $value) {

    $doopnamen .= substr($value, 0, 1);

}

But how can i get a dot after each letter ?
Thanks in advice John

Not tested, but try:

$words = explode(',', implode('.,', $string));

this gives you an array again, if you want just a string then use just implode('.', $string).

Edit___
Or:

foreach($words as $value) { $doopnamen .= substr($value, 0, 1).'.'; }

so, if $string:

$string = 'alfa beta';

from the loop you get a.b. It was this you needed? Bye!

Thanks for your help Cereal

$words = explode(',', implode('.,', $string));

Gives an error

But

foreach($words as $value) { $doopnamen .= substr($value, 0, 1).'.'; }

Works great.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.