php - Regex for number comparison? -


i perform regex return true/false if input 5 digit input matching data in database, no need cater of sequence, need exact numbers.

eg: in database have 12345

when key in 5 digit value search, want find out whether matching each number inside 12345.

if key in 34152- should return true

if key in 14325- should return true

if key in 65432- should return false

if key in 11234- should return false

eg: in database have 44512

if key in 21454- should return true

if key in 21455- should return false

how using php regex

this way avoiding regex

<?php function cmpkey($a,$b){   $aa =  str_split($a); sort($aa);   $bb =  str_split($b); sort($bb);   return ( implode("",$aa) == implode("",$bb)); } ?> 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -