How to match the array and string?
$ A = 'abc123'; // How does the string match the following array? Array ([0] => abc123 [1] => 1231231 [2] => 123123123 [3] => 222aads2 [4] => 23232 [8] => 222211 [9] => asfds) uppercase and lowercase letters before and after the number must be matched. if one of them is matched, true is returned. otherwise, false is returned.
Reply to discussion (solution)
Match refers to in the array?
In_array ()?
$ A = 'abc123'; $ arr = Array (0 => 'abc123', 1 => '20180101', 2 => '20180101', 3 => '222aads2 ', 4 => '20140901', 8 => '20160901', 9 => 'asfds '); if (in_array ($ a, $ arr )) {echo 'matched successfully';} else {echo 'matched failed ';}
$ A = 'abc123'; $ arr = Array (0 => 'abc123', 1 => '20180101', 2 => '20180101', 3 => '222aads2 ', 4 => '20140901', 8 => '20160901', 9 => 'asfds '); if (in_array ($ a, $ arr )) {echo 'matched successfully';} else {echo 'matched failed ';}
It means you forget in_array. at half past one, you will not be able to remember it.