PHP 試験 上級 関数_001

<html>
<head>
<meta charset="UTF-8">
<style>
.img{}
.img > img{width: 50%; height: auto;}
</style>
</head>

<body>

<?php

mb_language("japanese");

mb_internal_encoding("UTF-8");

function img($file, $alt) {
$s = '<p class="img"><img';
$s .= ' src="' . $file . '"';
$s .= 'alt="' . $alt . '"';
$s .= '/></p>';
return $s;
}

echo img('KIMG0442.JPG', '合格');
echo img('to.jpg','身分');
?>

</body>
</html>