highlight_string

(PHP 4 , PHP 5)

highlight_string -- Applique la syntaxe colorisée à du code PHP

Description

mixed highlight_string ( string str [, bool return])

highlight_string() affiche la version colorisée du code PHP contenu dans le paramètre str, en utilisant les couleurs du système interne de colorisation de PHP.

Si le second paramètre optionnel return est fourni, et vaut TRUE alors highlight_string() retournera la chaîne colorisée au lieu de l'afficher immédiatement. Si le second paramètre ne vaut pas TRUE alors highlight_string() retournera TRUE en cas de succès, et FALSE sinon.

Exemple 1. Exemple avec highlight_string()

<?php
highlight_string
('<?php phpinfo(); ?>');
?>

L'exemple ci-dessus va afficher :

<code><font color="#000000">
<font color="#0000BB">&lt;?php phpinfo</font><font color="#007700">(); </font><font color="#0000BB">?&gt;</font>
</font>
</code>

Note : Le paramètre return est disponible depuis PHP 4.2.0. Auparavant, il prenait la valeur par défaut de FALSE

Voir aussi highlight_file() et show_source().