Ver Mensaje Individual
  #15 (permalink)  
Antiguo 09/05/2012, 14:33
alex760125
 
Fecha de Ingreso: enero-2010
Mensajes: 239
Antigüedad: 14 años, 3 meses
Puntos: 0
Respuesta: Comparar valores de un array.

$ndos= $_POST['ndos'];
$ntres= $_POST['ntres'];
$ncuatro= $_POST['ncuatro'];
$ncinco= $_POST['ncinco'];



$salida=$nuno."\t".$ndos."\t".$ntres."\t".$ncuatro ."\t".$ncinco."\t"."\n";
$fp = fopen("dprueba.txt", "a");
if(!$fp)
{
echo "<p><strong>Neca</strong></p>";
exit;
}
fwrite($fp, $salida);
fclose($fp);

$fp = fopen("dprueba.txt", "r");

$fc = fread($fp, filesize('dprueba.txt'));
$uno = substr_count($fc, "01");// acá tengo veces repetidas, parte baja del gráfico.
$dos = substr_count($fc, "02");
$tres = substr_count($fc, "03");
$cuatro = substr_count($fc, "04");
$cinco = substr_count($fc, "05");
$seis = substr_count($fc, "06");
$siete = substr_count($fc, "07");
$ocho = substr_count($fc, "08");
$nueve = substr_count($fc, "09");
$diez = substr_count($fc, "10");
$once = substr_count($fc, "11");
$doce = substr_count($fc, "12");
$trece = substr_count($fc, "13");
$catorce = substr_count($fc, "14");
$quince = substr_count($fc, "15");
$diezseis = substr_count($fc, "16");
$diezsiete = substr_count($fc, "17");
$diezocho = substr_count($fc, "18");
$dieznueve = substr_count($fc, "19");
$veinte = substr_count($fc, "20");
$veinteuno = substr_count($fc, "21");
$veintedos = substr_count($fc, "22");
$veintetres = substr_count($fc, "23");
$veintecuatro = substr_count($fc, "24");
$veintecinco = substr_count($fc, "25");
$veinteseis = substr_count($fc, "26");
$veintesiete = substr_count($fc, "27");
$veinteocho = substr_count($fc, "28");
$veintenueve = substr_count($fc, "29");
$treinta = substr_count($fc, "30");
$treintauno = substr_count($fc, "31");
$treintados = substr_count($fc, "32");
$treintatres = substr_count($fc, "33");
$treintacuatro = substr_count($fc, "34");
$treintacinco = substr_count($fc, "35");
$treintaseis = substr_count($fc, "36");
$treintasiete = substr_count($fc, "37");
$treintaocho = substr_count($fc, "38");
$treintanueve = substr_count($fc, "39");
$cuarenta = substr_count($fc, "40");
$cuarentauno = substr_count($fc, "41");
$cuarentados = substr_count($fc, "42");
$cuarentatres = substr_count($fc, "43");
$cuarentacuatro = substr_count($fc, "44");
$cuarentacinco = substr_count($fc, "45");
$cuarentaseis = substr_count($fc, "46");
$cuarentasiete = substr_count($fc, "47");
$cuarentaocho = substr_count($fc, "48");
$cuarentanueve = substr_count($fc, "49");
$cincuenta = substr_count($fc, "50");

fclose($fp);

$kkk = array(1=>$uno, 2=>$dos, 3=>$tres, 4=>$cuatro, 5=>$cinco, 6=>$seis, 7=>$siete, 8=>$ocho, 9=>$nueve, 10=>$diez, 11=>$once, 12=>$doce, 13=>$trece, 14=>$catorce, 15=>$quince, 16=>$diezseis, 17=>$diezsiete, 18=>$diezocho, 19=>$dieznueve, 20=>$veinte, 21=>$veinteuno, 22=>$veintedos, 23=>$veintetres, 24=>$veintecuatro, 25=>$veintecinco, 26=>$veinteseis, 27=>$veintesiete, 28=>$veinteocho, 29=>$veintenueve, 30=>$treinta, 31=>$treintauno, 32=>$treintados, 33=>$treintatres, 34=>$treintacuatro, 35=>$treintacinco, 36=>$treintaseis, 37=>$treintasiete, 38=>$treintaocho, 39=>$treintanueve, 40=>$cuarenta, 41=>$cuarentauno, 42=>$cuarentados, 43=>$cuarentatres, 44=>$cuarentacuatro, 45=>$cuarentacinco, 46=>$cuarentaseis, 47=>$cuarentasiete, 48=>$cuarentaocho, 49=>$cuarentanueve, 50=>$cincuenta);


while($elemento=each($kkk))
{
while($compara=each($kkk)
{
if($elemento["key"]!=$compara["key"])
{
if($elemento["value"]==$compara["value"])
unset($compara["key"]);
}
}
}


En este momento sólo quiero saber por qué no funciona mi código. Quiero saber si tiene sentido lo q he escrito en while.[/QUOTE]

Nota: Vector_latino te pido de favor q leas lo q necesito. Quiero corregir mi código.