There is any way to shorthand or dispatch this to one-line code?
$asd='http://asd.asd';
// $asd='[email protected]';
// $asd='+123123';
switch ($asd){
case strpos($asd, 'http')===0:
$qwe='href';
break;
case strpos($asd, '@')>1:
$qwe='mailto';
break;
case strpos($asd, '+')===0:
$qwe='tel';
$break;
}
It's not easy to read but you wanted it to be a single line of code. It's called ternary operator and you read more about it here.