public static function string($string, $foreground_colour = null, $background_colour = null)
    {
        $coloured_string = "";

        // Check if given foreground colour found
        if (isset(self::$foreground_colours[$foreground_colour])) {
            $coloured_string .= self::getForegroundCode($foreground_colour);
        }
        // Check if given background colour found
        if (isset(self::$background_colours[$background_colour])) {
            $coloured_string .= self::getBackgroundCode($background_colour);
        }

        // Add string and end colouring
        $coloured_string .= $string . self::getResetCode();

        return $coloured_string;
    }
public static function string($string, $foreground_colour = null, $background_colour = null)
    {
        $coloured_string = "";

        // Check if given foreground colour found
        if (isset(self::$foreground_colours[$foreground_colour])) {
            $coloured_string .= self::getForegroundCode($foreground_colour);
        }
        // Check if given background colour found
        if (isset(self::$background_colours[$background_colour])) {
            $coloured_string .= self::getBackgroundCode($background_colour);
        }

        // Add string and end colouring
        $coloured_string .= $string . self::getResetCode();

        return $coloured_string;
    }
public static function string ( $ string , $ foreground_colour = null , $ background_colour = null ) { $ coloured_string = "" ; // Check if given foreground colour found if ( isset ( self :: $ foreground_colours [ $ foreground_colour ] ) ) { $ coloured_string .= self :: getForegroundCode ( $ foreground_colour ) ; } // Check if given background colour found if ( isset ( self :: $ background_colours [ $ background_colour ] ) ) { $ coloured_string .= self :: getBackgroundCode ( $ background_colour ) ; } // Add string and end colouring $ coloured_string .= $ string . self :: getResetCode ( ) ; return $ coloured_string ; }
Adds colouring control codes to a string.

@param string $string            String to format.
@param string $foreground_colour Optional foreground colour for string.
@param string $background_colour Optional background colour for string.

@return string Formatted string.
Adds colouring control codes to a string .