Skip to content

Instantly share code, notes, and snippets.

@savepong
Created May 17, 2019 04:19
Show Gist options
  • Save savepong/ef52d927792e47fa11789ad5f12d912e to your computer and use it in GitHub Desktop.
Save savepong/ef52d927792e47fa11789ad5f12d912e to your computer and use it in GitHub Desktop.
เช็คว่ามีเป็นตัวเลขใน string หรือไม่? และมีกี่ตัว?
$str = '183293819203';
preg_match_all('!\d!', $str, $numbers);
dd( count($numbers[0])==13 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment