<?php $a = [ 'sss4444dfdf', //лишние '444444', //много 'sdfsdf', //все не то '', // '4', //мало ]; print_r(preg_replace('/^\D*(\d{1,4})\D*$/', '$1', $a));
You have javascript disabled. You will not be able to edit any code.