I'm trying to replace users phone numbers to start with 1 instead of 0 but I'm stuck.
I have this line $mobileNumber = implode(',', $postData['phone']);
which outputs "0445329500,0569075729,0456786942"
I want to replace all the first 0 with 1 so instead of 0445329500,0569075729,0456786942
it should be 1445329500
,1569075729
,1456786942
I have tried this Str::replaceFirst('0','1',$mobileNumber);
it only replaces the first number 1445329500
Any help will be appreciated.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire