Difference between revisions of "PHP"

Jump to: navigation, search

Note: You are currently viewing documentation for Moodle 2.5. Up-to-date documentation for the latest stable version of Moodle may be available here: PHP.

Line 1: Line 1:
if (!function_exists('geshi_highlight')) {
    * Easy way to highlight stuff. Behaves just like highlight_string
    * @param string The code to highlight
    * @param string The language to highlight the code in
    * @param string The path to the language files. You can leave this blank if you need
    *              as from version 1.0.7 the path should be automatically detected
    * @param boolean Whether to return the result or to echo
    * @return string The code highlighted (if $return is true)
    * @since 1.0.2
function geshi_highlight ($string, $language, $path, $return = false)
$geshi = new GeSHi($string, $language, $path);
if ($return) {
return '<code>' . $geshi->parse_code() . '</code>';
echo '<code>' . $geshi->parse_code() . '</code>';
if ($geshi->error()) {
return false;
return true;

Revision as of 02:35, 21 May 2006