note 39402 deleted from function.fopen by nlopess
| From: | nlopess@php.net | Date: | Tue, 27 Jan 2004 15:39:54 +0000 |
| Subject: | note 39402 deleted from function.fopen by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-64262@lists.php.net to get a copy of this message | ||
Note Submitter: Nobody
----
Hi , I have a doubt why the function split not return the first element :
Look the code:
function Ver()
{
$archi="palet.txt";
$fp=fopen($archi,"r");
$contenido=fread($fp,filesize($archi));
fclose($fp);
$datos2=split(':',$lineas[0]);
echo($datos2[0]);
}
function comparar($Valor)
{
$archi="palet.txt";
$fp=fopen($archi,"r");
$contenido=fread($fp,filesize($archi));
fclose($fp);
$lineas=split(";",$contenido);
$Total=sizeof($lineas);
for ($a=0; $a <$Total; $a++)
{
$datos=split(':',$lineas[$a]);
if($datos[0]==$Valor)$retorno=0;
else
{
$retorno=1;
if($datos[0]!='')
$concatenar.= $datos[0].":;";
}
}
if($retorno)$concatenar.= $Valor.":;";
$fp=fopen($archi,"w");
fwrite ($fp,$concatenar);
fclose($fp);
return $retorno;
}
$PalRand=rand(1,160);
comparar($PalRand);
Ver();