|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2001-08-19 03:43 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 00:00:02 2025 UTC |
function conf_append($file,$in,$top="<?php\r\n",$bottom=");?>") { $ya=file_exists($file)?1:0; eval("if(\$ourfile=fopen(\$file,'".($ya?'r':'a')."+b')) {".($ya?"fseek(\$ourfile,-strlen(\$bottom),SEEK_END);":"")." fwrite(\$ourfile,".(!$ya?"\$top.":"")."\$in.\$bottom); fclose(\$ourfile);}"); } We can't change pointer file position when we open it with 'a+', but may when 'r+'/ So we need for create open with 'a+', and if file exists 'r+'