- substr: documentation ( source)
- strpos: documentation ( source)
- str_replace: documentation ( source)
<?php
$phonenumer = '+31 (0)612345678';
$phonenumber = str_replace([' ', '-', '.', '(', ')'], '', $phonenumber);
if (strpos($phonenumber, '+3106') === 0) {
$phonenumber = '+316' . substr($phonenumber, 5);
}
echo $phonenumber;