TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Tips & Tricks (http://www.talkphp.com/tips-tricks/)
-   -   I thought this was cute (http://www.talkphp.com/tips-tricks/5016-i-thought-cute.html)

cachepl0x 10-12-2009 05:11 AM

I thought this was cute
 
My friend proposed to his now fiance with this script, and I thought it was cute. He first showed her the output, she was excited, but thought it was lack-luster. Then, he showed her the source, and since their are both PHP developers, she thought it was incredibly sweet.

It's really simple, but I guess it did it's job, lol.

PHP Code:

class Hash
{
    public 
$word$arr$val;

    public function 
strtohash($word)
    {
        
$val md5(sha1($word));
        if (isset(
$val))
        {
            
$arr = array(
                
"9" => "I LOVE YOU, ",
                
"bdb" => "please be my ",
                
"3f3b" => "wife! ",
                
"0df77fc" => "I will treat you right, ",
                
"f3f334" => "so please, ",
                
"5eb53" => "say yes.",
                
"6b1e2f" => " <3"
                
            
);
        }
        
        return 
strtr($val$arr);
    }
}

$h = new Hash();
echo 
$h->strtohash("THIS IS A STRING"); 


ryanmr 10-12-2009 05:40 AM

That is pretty sweet. While only programmers can appreciate the code, pretty much anyone can appreciate the message.

fantomel 03-24-2010 09:43 PM

pretty cool and sweet i think :) good idea.

delayedinsanity 03-24-2010 10:17 PM

Oh wow. Talk about being out-geeked!

(also, holy thread revival batman.)

AxelG 02-18-2012 08:04 PM

I will try with my next girlfriend :)


All times are GMT. The time now is 09:05 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0