84 Chapter 2 Advanced Syntax Figure 2.13 Input
86 Chapter 2 Advanced Syntax Self-Modifying Counter To name just a simple example, hit counters can be created using self-modifying code. Usually, hit counts would be calculated from log files or retrieved from a database but a much simpler method is to use self-contained counters. Self-contained means that counter code and counter data are actually in the same file: $counter = 0; ////////////////////////////////// // Do not modify above this point ////////////////////////////////// // increase counter $counter++; // write counter back to ourselves $file = fopen(basename($PHP_SELF), r+ ); fputs($file,
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost PHP Web Hosting services