php - Search for a binary number in a set that contains a 1 or 0 in certain locations -
I have strings (zero and others) that have a format similar to the following:
[01100101], [10010000], [00000001] ... and so on (all the same length, there are about 30 entries)
I want to be able to search similar to "0xxxx01" Search for these numbers using search will return the first and the third string in this case.
What would be the best way to do this? I am in the middle of learning PHP, an answer will be liked in that format. Posted by Building @ George Launde (you need to use X instead of X)
Top of answer:
$ arr = array ('01100101', '10010000', '00000001'); $ Result = preg_grap ("/ 0 ..... 01 /", $ arr); Print_r ($ result);
Comments
Post a Comment