PHP - AYUDA no consigo acabar todo

 
Vista:

AYUDA no consigo acabar todo

Publicado por bruno (1 intervención) el 27/04/2018 12:26:03
de momento tengo esto en PHP

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<html lang="es>
	<head>
		<meta charset="utf-8">

		<!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame
		Remove this if you use the .htaccess -->
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
 
		<title>letras del alfabeto</title>
		<meta name="description" content="">
		<meta name="author" content="alumno">
 
		<meta name="viewport" content="width=device-width; initial-scale=1.0">
 
 
	</head>
 
	<body>
		<div>
			<header>
				<h1>letras del alfabeto</h1>
			</header>
			<nav>
				<p>
					<a href="letras del alfabeto.php">Volver al formulario</a>
				</p>
 
			</nav>
 
			<div>
<form method="POST">
frase: <input type="text" name="frase" style="width: 40px"> <b><font size="4">
<input type="submit" name="submit">
</form>
<?php
function alfabeto($string){
$string = strtr($string,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ','bcdefghijklmnopqrstuvwxyzaBCDEFGHIJKLMNOPQRSTUVWXYZA');
$string = str_replace(' ', '', $string);
return strtoupper($string);
}
 
$frase = 'me gusta programar';
 
if(strpos($frase, 'ñ') !== false OR strpos($frase, 'á') !== false OR strpos($frase, 'é') !== false OR strpos($frase, 'í') !== false OR strpos($frase, 'ó') !== false OR strpos($frase, 'ú') !== false){
	die('error');
}
 
echo alfabeto($frase); // devuelve 'NFHVTUBQSPHSBNBS'
?>


me piden que en otro archivo PHP teniendo esto ,tengo que hacer unas modificaciones

Ampliar la funcionalidad del programa anterior para realizar la rotación de longitud n (n será un número entero mayor de 0) de un texto.

Ejemplo: La cadena "ME gusta programar", con una rotación de longitud, 3, se convertirá en:
"PHJXVWDSURJUDPDU"
Ayuda: Una rotación de longitud 3 equivale a 3 rotaciones seguidas de longitud 1.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
-1
Responder