Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $mobile_array = explode(",",$mobile_list); // turn into an array
- $landlines = array_count_values($mobile_array); // create count variable
- echo $landlines["020..."]; // print the number of numbers
- $mobile_list = '02000, 02032435, 039002300, 00305600';
- $mobile_array = explode(",",$mobile_list); // turn into an array
- $landlines = array_count_values($mobile_array); // create count variable
- $sequence = '020'; // print the number of numbers
- function filter_phone_numbers($mobile_array, $sequence){
- return array_filter($mobile_array, function ($item) use ($sequence) {
- if (stripos($item, $sequence)) {
- return true;
- }
- return false;
- });
- }
- $filtered_items = filter_phone_numbers($mobile_array, $sequence);
- echo count($filtered_items);
- $mobile_list = '02000, 02032435, 039002300, 00305600';
- $mobile_array = explode(",",$mobile_list); // turn into an array
- $landlines = array_count_values($mobile_array); // create count variable
- $sequence = preg_quote('020', '~'); ; // print the number of numbers
- function grep_phone_numbers($mobile_array, $sequence){
- return preg_grep('~' . $sequence . '~', $mobile_array);
- }
- $filtered_items = grep_phone_numbers($mobile_array, $sequence);
- echo count($filtered_items);
- $numbers = [
- '07000000000',
- '02000000000',
- '07000000000',
- '07000000000',
- '02000000000',
- ];
- function landlineCount($carry, $item)
- {
- if (substr($item, 0, 3) === '020') {
- return $carry += 1;
- }
- return $carry;
- }
- $count = array_reduce($numbers, 'landlineCount');
- echo $count;
- SELECT * FROM phone_numbers WHERE number LIKE '020%'
- $mobile_list = "071234567890,02039989435,0781,020122,123020";
- preg_match_all("/b020d+b/", $mobile_list, $m);
- var_dump($m);
- echo count($m[0]); // 2
- $no = "020XXXXXXX";
- if (strpos($no, '020') !== false) {
- echo 'its a landline number';
- }
Add Comment
Please, Sign In to add comment