showing source

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This almost works but all my < and > are replaced with "".

       // open this file to show the source
       if (($fh = fopen( __FILE__, 'r' )) === FALSE){
die ('Failed to open source file (' . $_FILE_ . ') for reading!');
       } else {
           $tags  = array( "<", ">" );
           $safe_tags = array( "\\<", "\\>" );

           print "<pre>\n";

           // read the file line by line
           while (! feof( $fh )) {
               $currentLine = fgets( $fh, 255 );
               $noTags = str_replace( $tags, $safeTags, $currentLine );
               print $noTags;
           }

           fclose( $fh );
           print "</pre>\n";
       }

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux