PDA

View Full Version : Well... (warning: pointless)


Kitchensink108
6-17-05, 03:50 PM
I got bored at work yesterday, so I wrote a PHP function that took a number, converted it to binary, then generated a javascript function to convert it back to base 10, which was then displayed. Yes, it was useless.

But then I remembered that both PHP and Javascript have automatic base conversion functions. Decided to test the speed of my PHP conversion script to the the speed of bindec(), and found my code was, on average, 10 times slower.

Moral of the story: predefined functions > anything i make.

mjp
6-17-05, 05:03 PM
But reinventing the wheel is half the fun of any programming language!

satis
6-17-05, 06:22 PM
hell yea. I spend more time manually creating stuff already defined in a function somewhere then I do creating the actual application.

On a positive note, when you build it yourself, any odd behaviour is immediately evident. Using some predefined function can cause some oddities that aren't so easily explainable.