WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Convert a Hex color string to a Decimal string.
Categories : PHP, HTML and PHP Click here to Update Your Picture
Michael Stearne
Date : Dec 23rd 1999
Grade : 2 of 5 (graded 1 times)
Viewed : 5473
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Michael Stearne
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

// This function will convert a Hex color string in the form #AAAAAA the decimal
//Representation of it. It will return an array with three elements, element 0 is the Red color
//in a decimal, element 1 is the Green color in a decimal, element 2 is the Blue color in a decimal
//(Base 10 number)
// Michael Stearne
// Usage:
// $hex="564356";
// if($R=HexColor2Dec($hex))print "$R[0] $R[1] $R[2]";

function HexColor2Dec($HexNumber){
$HexNumber=str_replace("#","",$HexNumber);

if(strlen($HexNumber)!=6){
echo "Please supply Hex numbers in #AAAAAA or AAAAAA format.";
return false;
}
$R=substr($HexNumber,0,2);
$G=substr($HexNumber,2,2);
$B=substr($HexNumber,4,2);
$RDec=(substr($R,0,1)*16)+(substr($R,1,1));
$BDec=(substr($B,0,1)*16)+(substr($B,1,1));
$GDec=(substr($G,0,1)*16)+(substr($G,1,1));
$RGBColor[0]=$RDec;
$RGBColor[1]=$GDec;
$RGBColor[2]=$BDec;
return $RGBColor;
}



PHP3: Formmail. Just a cgi formmail, but than in PHP. It is easy to use!
Categories : HTML and PHP, Email, PHP, Perl, HTML and PHP
Pull deliniated text strings into a "SELECT" statement in a form.
Categories : HTML and PHP, PHP, Strings
Handle multiple file upload
Categories : Complete Programs, Filesystem, PHP, HTML and PHP
php table decoder used to convert an html table to individual tokens through regular expressions
Categories : PHP, Regexps, HTML and PHP
Directory viewer, customize how you display the file structure, easy to understand. Found out about PHP 3 days ago, and this is my first prog.
Categories : HTML and PHP, Complete Programs, Directories, Filesystem, PHP
Convert date's in YYYY-MM-DD (i.e. mysql format) into PHP3 timestamps. Also Find the difference in days between two PHP3 timestamps.
Categories : HTML and PHP, PHP, MySQL, Date Time
This is a redirection program which is as good as the come.to v3 url redirection, complete with admin interface all clients stored in mysql
Categories : PHP, MySQL, Ecommerce, HTML and PHP, Complete Programs
PHP3 PHP POP3 SMTP MAIL
Categories : PHP, Email, HTML and PHP
php html calendar dynamic
Categories : HTML and PHP, PHP, Calendar
If you want to create select buttons featuring current date this example will show you how...
Categories : Date Time, HTML and PHP, PHP
Creates three SELECT form fields: Month, Day, and Year. You give it a string which will be used to make the name for the three fields, and a number of seconds to use as the default date. If you give it blank for this value, the current date is used.
Categories : HTML and PHP, PHP, Date Time
This PHP function creates dropdown select lists for time and date that you can change, outputs a 14 char MySQL timestamp in a text field
Categories : PHP, MySQL, Java Script, HTML and PHP
PHP and MySQL scripting for Muyltiple CheckBoxes
Categories : HTML and PHP, MySQL, Databases, PHP
Kewl Date Example
Categories : PHP, HTML and PHP, Date Time, CSS, Beginner Guides
Newbie Notes #9 - Hyperlinking a post
Categories : PHP, Java Script, HTML and PHP, Beginner Guides
 Jovaras wrote :480
//this could do more (i mean supporting a,b,c,d,e,f charachters)

function sk_raid($sk)

  $sk=strtoupper($sk);
   switch ($sk)
  {
  case "A" :$skaicius=10;break;
  case "B" :$skaicius=11;break;
  case "C" :$skaicius=12;break;
  case "D" :$skaicius=13;break;
  case "E" :$skaicius=14;break;
  case "F" :$skaicius=15;break;
  case "0" :$skaicius=0;break;
  default  : if(intval($sk)!=0){$skaicius=$sk;break;}
  $skaicius=999;
  }
  return $skaicius;
}

function HexColor2Dec($HexNumber){ 
$HexNumber=str_replace("#","",$HexNumber); 
if(strlen($HexNumber)!=6){ 
echo "Please supply Hex numbers in #AAAAAA or AAAAAA format."; 
return false; 

$spalva=substr($HexNumber,0,2); 
$spalva=sk_raid(substr($spalva,0,1))*16+sk_raid(substr($spalva,1,1));
if ($spalva<=255)$RGBColor[0]=$spalva;
else $RGBColor[0]=" Illegal character found";
$spalva=substr($HexNumber,2,4);
$spalva=sk_raid(substr($spalva,0,1))*16+sk_raid(substr($spalva,1,1));
if ($spalva<=255)$RGBColor[1]=$spalva;
else $RGBColor[1]=" Illegal character found ";
$spalva=substr($HexNumber,4,6); 
$spalva=sk_raid(substr($spalva,0,1))*16+sk_raid(substr($spalva,1,1));
if ($spalva<=255)$RGBColor[2]=$spalva;
else $RGBColor[2]=" Illegal character found ";
return $RGBColor;