<?php
$string = 'In this sentence I want to explain both, word1 and word2.';
$terms = array(
'word1' => '<span title="This is a short description of word1">word1</span>',
'word2' => '<span title="word2 maybe has something to do with word1">word1</span>',
);
echo strtr($string, $terms);