Posible solucion para el ejercicio a), b), c) y d) del curso de programación web con php: Función fopen (modo), fgets, fputs, fclose y feof.
<!DOCTYPE html>
<html>
    <head>
        <title>Ejemplo aprenderaprogramar.com</title>
        <meta charset="utf-8">
    </head>
    <body>
        <form name="formularioDatos" method="post" action="fp.php">
        Introduzca primer numero: <input type="text" name="numero1" value="">
        <br/> <br/>
         Introduzca segundo numero: <input type="text" name="numero2" value="">
        <br/> <br/>
         Introduzca tercer numero: <input type="text" name="numero3" value="">
        <br/> <br/>
        <input value="Enviar" type="submit" />
        </form>
    </body>
</html>
PHP que cree..
<?php 
	
	$numero1 = $_POST["numero1"];
	$numero2 = $_POST["numero2"];
	$numero3 = $_POST["numero3"];
	
	function escribirTresNumeros($numero1, $numero2, $numero3)
		{
			$fp = fopen("datosEjercicio.txt", "w");
			
			fputs($fp, $numero1."\n". $numero2 ."\n". $numero3 ."\n");
			
			fclose($fp);
		}
			
			echo "$numero1";
			echo "<br>";
			echo "$numero2";
			echo "<br>";
			echo "$numero3";
			
	
		
	function obtenerSuma($ruta)
		{	
			$resul = 0;
			$aux = 0;
			$linea = array();
			$fp = fopen($ruta, "r");
			
			while (!feof($fp)) {
				$linea[$aux] = fgets($fp);
				$aux++;
			}
			for ($i=0; $i < count($linea); $i++) { 
				$resul = $resul + $linea[$i];
			}
			fclose($fp);
			echo "<br>";
			return $resul;
		}
		
		function obtenerArrNum($ruta)
		{	
			$array = array();
			$cont = 0;
			$fp = fopen($ruta, "r");
			while (!feof($fp)) {
				$array[$cont] = fgets($fp);
				$cont++;
			}
			fclose($fp);
			return $array;
		}
		escribirTresNumeros(2, 8, 14);
		echo "Suma: " . obtenerSuma("datosEjercicio.txt");
		echo "<br/>";
		$arrayObtenido = obtenerArrNum("datosEjercicio.txt");
		echo "<br/>Elementos del array obtenido con la función: </br>";
		for ($i=0; $i < count($arrayObtenido) - 1; $i++) { 
		echo $arrayObtenido[$i] .", ";
		}
	
?>