Back to index

php5  5.3.10
create_data_file.php
Go to the documentation of this file.
00001 /* This is a generated file, do not modify */
00002 /* Usage: php create_data_file.php /path/to/magic.mgc > data_file.c */
00003 <?php
00004        $dta = file_get_contents( $argv[1] );
00005        $dta_l = strlen($dta);
00006        $j = 0;
00007 
00008        echo "const unsigned char php_magic_database[$dta_l] = {\n";
00009        for ($i = 0; $i < $dta_l; $i++) {
00010               printf("0x%02X, ", ord($dta[$i]));
00011               if ($j % 16 == 15) {
00012                      echo "\n";
00013               }
00014               $j++;
00015        }
00016        echo "};\n";
00017 ?>