PHP正则表达式使前导零成为强制性

I am trying to validate an input and the rules (conditions) are:

  1. The value should be exactly 11 characters long and digit only
  2. The value should start with Zero '0'

I have managed to find a solution for rule number one and the code looks like following

$str='01272095631';
if (!preg_match('/^[0-9]{11}+$/', $str)) {$error= "Yes";} else {$error= "No";}

echo $error;

Could you please help me with the rule number 2?

You are thinking to complicated. Keep things simple:

/^0[0-9]{10}$/

if (!preg_match('/^0[0-9]{10}+$/', $str)) {
    $error= "Yes";
} else {
    $error= "No";
}

echo $error;

Slightly reduced pattern :)

'/^0\d{10}$/'