<?php
function test($html)
{
$matched = preg_match('/<meta[^>]*name=[^>]*viewport[^>]*>/', $html, $matches);
if (!$matched) {
return false;
}
if (preg_match('/(user-scalable=(0|no)|scale)/', $matches[0])) {
// 95% of the time this indicates true mobile compatibility (cf SYS-1289)
return true;
}
if (preg_match('/width=(\d{2}|[7-9])\d{2}/')) {
// Specifying a width of other 700px, doesn't sound very mobile compatible (cf SYS-1289)
return false;
}
// At this point some websites are mobile compatible, others aren't, so we'll just go with the most likely
return true;
}
var_dump(test('<meta content="width=1024" name="viewport"/>'));
Fatal error: Uncaught ArgumentCountError: preg_match() expects at least 2 arguments, 1 given in /in/cKSkB:16
Stack trace:
#0 /in/cKSkB(16): preg_match('/width=(\\d{2}|[...')
#1 /in/cKSkB(25): test('<meta content="...')
#2 {main}
thrown in /in/cKSkB on line 16
Process exited with code 255.