PHP Classes

File: examples/beautifier/create_samples.php

Recommend this page to a friend!
  Classes of Christian Vigh   PHP RTF Tools   examples/beautifier/create_samples.php   Download  
File: examples/beautifier/create_samples.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: PHP RTF Tools
Parse and generate RTF documents using templates
Author: By
Last change:
Date: 8 years ago
Size: 1,144 bytes
 

Contents

Class file image Download
<?php
   
/****************************************************************************************************
   
        Creates two files by catenating the contents of 'sample_file.rtf' located in this directory :

        - 'bigfile.rtf', which will be around 40Mb
        - 'verybigfile.rtf', which will be around 800Mb. This is big enough to cause a fatal error
          when trying to read it into memory (at least on Windows systems).

        Of course, the generated rtf files won't be valid but it will allow to demonstrate the
        capabilities of the RtfTools classes that operate directly on files.

     ****************************************************************************************************/

   
$sample = 'sample.rtf' ;
   
$bigfile_copies = 50 ;
   
$very_bigfile_copies = 1000 ;

   
$contents = file_get_contents ( $sample ) ;

   
$fp = fopen ( "bigfile.rtf", "w" ) ;

    for (
$i = 0 ; $i < $bigfile_copies ; $i ++ )
       
fputs ( $fp, $contents ) ;

   
fclose ( $fp ) ;

   
$fp = fopen ( "verybigfile.rtf", "w" ) ;

    for (
$i = 0 ; $i < $very_bigfile_copies ; $i ++ )
       
fputs ( $fp, $contents ) ;

   
fclose ( $fp ) ;