Show sourcecode
The following files exists in this folder. Click to view.
strings.php
strings1.php
strings1fb.php
strings2.php
strings2fb.php
strings3.php
strings3fb.php
strings4.php
strings4fb.php
strings5.php
strings5fb.php
strings6.php
strings6.php
41 lines UTF-8 Windows (CRLF)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Stränghantering</title>
</head>
<body>
<?php
if (isset($_POST["text"])) {
$text = $_POST["text"];
$newText = "";
$cons = ["b","c","d","f","g","h","j","k","l","m","n","p","q","r","s","t","v","w","x","z"];
for ($i = 0; $i < mb_strlen($text); $i++) {
$letter = mb_substr($text, $i, 1);
$letterLow = mb_convert_case($letter, MB_CASE_LOWER);
if (in_array($letterLow, $cons)) {
foreach ($cons as $con) {
if ($letterLow == $con) {
$newText = $newText.$letter."o".$letterLow;
}
}
} else {
$newText = $newText.$letter;
}
}
}
echo "<p>$text<br>$newText</p>";
?>
<form method="post" action="">
<textarea rows="4" cols="10" name="text" placeholder="Text"></textarea><br>
<input type="submit" value="Skicka">
</form>
</body>
</html>