PHP-Snippets
 php::MySQL (0)
 php::Image (4)
   » Bild - Boxskalierung
   » Hex-Farbcode -> Farb-Array
   » Farb - Aufheller
   » Farb - Abdunkler
 php::Sonstiges (4)
   » Einfache Template-Funktion
   » Simple HTTP-Post Funktion
   » Simple HTTP-Get Funktion
   » zwischen()-Funktion
 php::Spezielles (2)
   » Zeichenvorkommisse prüfen
   » Array mischen (seeded)
Snippet: Hex-Farbcode -> Farb-Array

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
<?php
function colorconvert($color// Konvertiert Hex-Farbcode in RGB-Array
{
    
$colors = Array();
    if(
strlen($color) == 6)
    {
        
$colors[0] = @hexdec(substr($color02));
        
$colors[1] = @hexdec(substr($color22));
        
$colors[2] = @hexdec(substr($color42));
        if(
$colors[0] > 255 || $colors[0] < 0) { $colors[0] = 0; }
        if(
$colors[1] > 255 || $colors[1] < 0) { $colors[1] = 0; }
        if(
$colors[2] > 255 || $colors[2] < 0) { $colors[2] = 0; }
    }
    else
    {
        
$colors[0] = 0;
        
$colors[1] = 0;
        
$colors[2] = 0;
    }
    return 
$colors;
}
?>