note 39402 added to function.fopen

From: Date: Tue, 27 Jan 2004 15:37:38 +0000
Subject: note 39402 added to function.fopen
Groups: php.notes 
Request: Send a blank email to php-notes+get-64261@lists.php.net to get a copy of this message
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(); ---- Manual Page -- http://www.php.net/manual/en/function.fopen.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+39402 Delete -- http://master.php.net/manage/user-notes.php?action=delete+39402&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+39402&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#64261) next »