Copy to Clipboard

I have seen a couple of sites, that are driven by php, using a link to copy code samples to the clipboard. I am wondering how I can add this to a page that I am building. I am not sure if it is a PHP or javascript function.

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP. PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…