This commit is contained in:
2024-01-29 10:39:53 +07:00
parent 545c404fdf
commit 72170f373a
143 changed files with 20188 additions and 3 deletions

View File

@@ -0,0 +1,22 @@
<?php
namespace Hura8\System\Security;
class DataFormatter
{
//remove space, ., ,
//add 84 to 0923232123 -> 84923232123
//dont change 84923232123 -> 84923232123
public static function formatMobile($mobile) {
$mobile = preg_replace("/[^0-9]/i", "", $mobile);
$first_2 = substr($mobile, 0, 2);
if( $first_2 != '84') {
return '84'.substr($mobile, 1);
}
return $mobile;
}
}