Skip to content

Instantly share code, notes, and snippets.

@msng
Created December 2, 2013 05:45

Revisions

  1. msng created this gist Dec 2, 2013.
    14 changes: 14 additions & 0 deletions generate.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    <?php
    $code = '<?php
    $array = [
    ';

    for ($i = 0; $i <= 7; $i++) {
    $code .= " 'key" . chr($i) . "' => 'value_" . $i . "',\n";
    }

    $code .= '];
    print_r($array);
    ';

    file_put_contents('./keys.php', $code);
    Binary file added keys.php
    Binary file not shown.
    Binary file added keys.rb
    Binary file not shown.
    6 changes: 6 additions & 0 deletions keys_sample.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    <?php
    $keys = [];
    for ($i = 0x0; $i < 0x20; $i++) {
    $keys[chr($i)] = sprintf('%02s', strtoupper(dechex($i)));
    }
    print_r($keys);