Skip to content

Instantly share code, notes, and snippets.

@lbvf50mobile
Last active September 2, 2020 15:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lbvf50mobile/a468785a319b08440036ecfc7e7b7bba to your computer and use it in GitHub Desktop.
Save lbvf50mobile/a468785a319b08440036ecfc7e7b7bba to your computer and use it in GitHub Desktop.
Just PHP FUN 092.
<?php
# https://www.codewars.com/kata/526dbd6c8c0eb53254000110 Not very secure.
function alphanumeric(string $s): bool {
return ctype_alnum($s);
}
#------------------------------------------------------------------------
function alphanumeric(string $s): bool {
echo "Input: $s \n";
if(!is_string($s)) return false;
$answer = boolval(preg_match('/^[a-z0-9]+$/i',$s));
$answer ? print("It is true.\n") : print("It is false.\n");
return $answer;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment