I thought about my previous version and it will take the first character of a string not the first of the first paragraph.
If you said paragraph, I thought that you were using "<p>" and then this should work:
PHP Code:
$article = "This is a heading and is not to be included
<p>Once upon a time, there was a ... ;) </p>
<p>later they found out that ...</p>";
$letter = substr($article, strpos($article, '<p>') + 3, 1);
// the image based on the first character of the article
$image = '<img src="path/to/images/'.$letter.'.gif" width="50" height="50">';
// now need to remove the first character of the article
$heading = substr($article, 0, strpos($article, '<p>'));
$article = $heading . '<p>'. $image . substr($article, strpos($article, '<p>') + 4, strlen($article));
// put everything together and output it
echo '<pre>';
echo htmlspecialchars($article);
echo '</pre>';
Bookmarks