- var_dump: documentation ( source)
- preg_match: documentation ( source)
- str_replace: documentation ( source)
<?php
function isOutgoingCall($phone)
{
$phone = str_replace('+', '', $phone);
return preg_match('#^([456]?(380|0)[0-9]{9})$#', $phone);
}
$isOutgoingCallFunctionResult1 = isOutgoingCall('380957600623');
var_dump($isOutgoingCallFunctionResult1);
$isOutgoingCallFunctionResult2 = isOutgoingCall('0957600623');
var_dump($isOutgoingCallFunctionResult2);
$isOutgoingCallFunctionResult3 = isOutgoingCall('4380957600623');
var_dump($isOutgoingCallFunctionResult3);
$isOutgoingCallFunctionResult4 = isOutgoingCall('40957600623');
var_dump($isOutgoingCallFunctionResult4);
$isOutgoingCallFunctionResult5 = isOutgoingCall('5380957600623');
var_dump($isOutgoingCallFunctionResult5);
$isOutgoingCallFunctionResult6 = isOutgoingCall('50957600623');
var_dump($isOutgoingCallFunctionResult6);
$isOutgoingCallFunctionResult7 = isOutgoingCall('6380957600623');
var_dump($isOutgoingCallFunctionResult7);
$isOutgoingCallFunctionResult8 = isOutgoingCall('60957600623');
var_dump($isOutgoingCallFunctionResult8);
$isOutgoingCallFunctionResult9 = isOutgoingCall('0123456789');
var_dump($isOutgoingCallFunctionResult9);