Задание:
Написать функцию создания ссылки:
Пример использования:
$href = "https://ot7.ru/?p=545"; $text = "Lorem ipsum"; $class = "myhref"; my_href($href, $text, $class);
должны получить:
<a href="https://ot7.ru/?p=545" class=".myhref">Lorem ipsum</a>
[spoiler title=»Решение»]
<?
$href = "https://ot7.ru/?p=545";
$text = "Lorem ipsum";
$class = "myhref";
my_href($href, $text, $class);
function my_href($href = "#", $text = 'ссылка', $class = 'link') {
echo "<a href='$href' class='.$class'>$text</a>";
}
?>
[/spoiler]