View Single Post
  #1  
Old 12-04-2006, 11:44 PM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
Retardating scripts, one at a time

Is retardating a word? Let's assume it is.

Just thought I'd share this script I made to convert decimal to hexadecimal, as an example of how retarded I can be.
I don't even know what I was doing, or why I was doing it. Then I looked at it and went '... Oh my god.' and created the latter.

PHP Code:
function math_DecToHex(decv) {
  
temp.hex "0123456789ABCDEF";
  
temp.places int(log(16,decv));
  
temp.total decv;
  for (
temp.temp.placestemp.>= 0temp.h--) {
    
temp.subtract int(temp.total/(16^temp.h));
    if (
temp.total 16^temp.h) continue;
    
temp.newvalue temp.subtract;
    
temp.total -= temp.subtract * (16^temp.h);
    
temp.toreturn @= temp.hex.substring(temp.subtract,1);
  }
  return 
temp.toreturn;

PHP Code:
function math_DecToHex(decv) {
  
temp.hex "0123456789ABCDEF";
  
temp.total decv;
  while (
int(temp.total) > 0) {
    
temp.toreturn temp.hex.substring(temp.total%16,1) @ temp.toreturn;
    
temp.total int(temp.total/16);
  }
  return 
temp.toreturn;

Reply With Quote