.01
.02
.03
.04
.05
.06
.07
.08
.09
.10
.11
.12
.13
.14
.15
.16
.17
.18
.19
.20
.21
.22
.23
.24
.25
.26
.27
.28
.29
.30
.31
.32
.33
.34
.35
.36
.37
.38
|
|
<?php
/******************************************************************************/
/* */
/* __ ____ */
/* ___ / / ___ / __/__ __ _____________ ___ */
/* / _ \/ _ \/ _ \_\ \/ _ \/ // / __/ __/ -_|_-< */
/* / .__/_//_/ .__/___/\___/\_,_/_/ \__/\__/___/ */
/* /_/ /_/ */
/* */
/* */
/******************************************************************************/
/* */
/* Titre : Supprime des tags dans une chaine */
/* */
/* URL : http://www.phpsources.org/scripts319-PHP.htm */
/* Auteur : nixi54 */
/* Date édition : 28 Déc 2007 */
/* */
/******************************************************************************/
// enleve les tags
function remove_tags($texte)
{
$tags_autorises = '<h3><h4><h5>';
$texte = strip_tags(stripslashes($texte), $tags_autorises);
return trim(preg_replace('/<(.*?)>/ie', "'<'.remove_tags('\\1').'>'", $texte));
}
$texte = '<h1>hello words</h1><h2>Im always here!!</h2>';
echo remove_tags($texte);
// affiche sans les tags
// hello wordsIm always here!!
?>
|