Is it possible to put HTML code in the middle of the output of a PHP function?
The French() function deletes the last letter of $word_one and appends an apostrophe to it, when $word_two begins with a vowel.
the function
function French($word_one, $word_two) {
if(preg_match('~(.*)\bje$~ui', $word_one, $m) && preg_match('~^[aeéio]~ui', $word_two))
return "{$m[1]}j'$word_two";
if(preg_match('~^[-]~ui', $word_two))
return "$word_two";
return "$word_one $word_two";
}
Code using the function:
for ($i = 0; $i <= 5; $i++) {
echo
'<tr>'."\n".
' <td><span data-text="'.French($pers[$i], strip_tags($array[0][$i])).'" data-lang="fr" class="trigger_play">'.French($pers[$i], $array[0][$i]).'</span></td>'."\n".
' <td>'.French($pers[$i], $array[0][$i]).'</td>'."\n".
'</tr>'."\n".
Everything is now printed in one td. But I want to print it in three td's, the first one is ok, but in the second and third td, it should also use the French(..) function.
How can I split French($pers[$i], $array[0][$i]) between the two TDs and get the following?
'<tr>'."\n".
' <td><span data-text="'.French($pers[$i], strip_tags($array[0][$i])).'" data-lang="fr" class="trigger_play">'.French($pers[$i], $array[0][$i]).'</span></td>'."\n".
' <td>'.$pers[$i].'</td>'.
' <td>'.$array[0][$i].'</td>'.
'</tr>'."\n".