-1
I have a problem with formatting phone numbers on my site written in PHP.
In this form, the user enters his phone number:
<div class="form-group">
<label class="control-label" for="phoneMobile">
<?php _e('Whatsapp "Recomendado"',); ?> <sup>*</sup>
</label>
<div class="controls">
<?php UserForm::mobile_text(osc_user()); ?>
</div>
</div>
after saving the whole process, the phone appears in the user profile:
<li>
<h3>Whatsapp</h3>
<h1 class="name"><i class="fa fa-whatsapp"></i><?php printf('%s', osc_user_phone_mobile()); ?></h1>
</li>
I am looking for a way for the number to appear formatted in the following pattern (xx) xxxxx-xxxx without using plugins or JS. The form is Bootstrap.
Do you need to be PHP? I’m sure there’s a mask in JS that already handles it perfectly. Luckily, a lot of people need to format phone numbers. I think if you search for "phone mask" right here on the site you will find a duplicate question of yours, already properly answered
– Jefferson Quesado
It doesn’t have to be php, I already researched yes... I even have several examples of masks here. My doubt is how, and where will I put these codes? All the ways I tried didn’t work out.
– Marcus Gabriel