note 60182 added to function.fwrite

From: Date: Thu, 29 Dec 2005 02:12:07 +0000
Subject: note 60182 added to function.fwrite
Groups: php.notes 
Request: Send a blank email to php-notes+get-100892@lists.php.net to get a copy of this message
Script that makes and writes to files, setting chmodes and everything correctly, much like a C ./configure would. ----------------------------------------------------------------- #!/usr/bin/php <?php /* ######################################### ### PHP Compiler System ### ######################################### ## Program Information: ####################### # Title: Compiler Test # Author: Navarr T. Barnier # Version: v1.0 # Email: admin@emerald.gtaero.net # Website: http://emerald.gtaero.net # AIM: navarr6 # YIM: navarr6 # ICQ: -=::NONE::=- # MSN: -=::NONE::=- ######################################### */ //###: Necesary Variables and Function Processing $argv1 = $_SERVER['argv'][1]; $files = array(); function cline($text = '') { print $text."\r\n"; } ################################################# $files = array(); $files['test'] = "<?php\r\n print 'Test';\r\n?>"; $files['test']['chmod'] = "777"; $files['test2'] = "<?php\r\n print 'Test';\r\n?>"; $files['test2']['chmod'] = "777"; $files['test3'] = "<?php ?>"; $files['test3']['chmod'] = "777"; ################################################# //###: Start Command Processing if ($argv1 == '--help') { cline('Type ./configure to Run the Processor.'); cline(); } elseif ($argv1 == '--info') { cline('This program was made to test the compiler system programmed by Navarr T. Barnier'); cline(''); cline('For Help on how to use it, type ./configure --help'); cline(); } else {; //###: Start Processing foreach($files as $file => $contents) { $fh = fopen($file,"w+"); fclose($fh); chmod($file, 0 .$files[$file]['chmod']); $fh = fopen($file,"w+"); fwrite($fh,$contents); fclose($fh); } } ?> ------------------------------------------------------- The data is stored properly in the array $files ---- Manual Page -- http://www.php.net/manual/en/function.fwrite.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+60182 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+60182&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+60182&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+60182&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+60182&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+60182&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+60182&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+60182&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+60182&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#100892) next »