Skip to content

Instantly share code, notes, and snippets.

@RandomArray
Created October 2, 2016 21:17
Show Gist options
  • Select an option

  • Save RandomArray/22cf409eee82de6d743f1db413cdc8ac to your computer and use it in GitHub Desktop.

Select an option

Save RandomArray/22cf409eee82de6d743f1db413cdc8ac to your computer and use it in GitHub Desktop.
Function returns true if string contains only zeros. Used to check for invalid serial numbers consisting of only zeros.
<?php
function stringContainsOnlyZeros($s){
return (is_numeric($s) && (int)$s===0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment