I’ve seen this elsewhere in Magento code where the assumption is made that skus are non-numeric.

It looks something like this. I don’t remember the exact method.

// $search passed into a method call
if (is_numeric($search)) {
// Assumes $search is an id if numeric
$product = Mage::getModel(‘catalog/product’)->load($search);
} else {
$product = Mage::getModel(‘catalog/product’)->loadByAttribute(‘sku’, $search);
}