Login   Register  
PHP Classes
elePHPant
Icontem

Fix function delete_key

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      INI Manager  >  All threads  >  Fix function delete_key  >  (Un) Subscribe thread alerts  
Subject:Fix function delete_key
Summary:Fix function delete_key
Messages:1
Author:sam
Date:2010-10-20 09:11:06
 

  1. Fix function delete_key   Reply  
Picture of sam
sam
2010-10-20 09:11:07
function delete_key( $path, $keyNAME )
{
$fileCONTENTS = "" ;

$this->filePATH = $path ;
$INIarray = $this->parse_ini_file( $path );

if ( is_array( $INIarray ) )
{
foreach ($INIarray as $i => $a)
{
$c2 = 0 ;

if ( is_array( $a ) )
{
foreach ($a as $n => $value)
{
if (strcmp( $i, $keyNAME ) != 0 )
{
if ( $c2 == 0 ) $fileCONTENTS .= "[$i]$this->crlf$n=$value$this->crlf";
else if ( strlen( $value ) != 0 ) $fileCONTENTS .= "$n=$value$this->crlf";
$c2++;
}
}

$fileCONTENTS .= $this->crlf ;
}
}
}

$hFile = @fopen( $path, "w+" );
@fwrite( $hFile, $fileCONTENTS );
@fclose( $hFile );
}