Is there a built-in php function to increment alpha characters? For example,

$datafile = array();

$datafile[0] = "a"; // begins with "a"
$datafile[1] = "b";
$datafile[2] = "c";
... // after "z" start with "aa"
$datafile_array[26] = "aa";
$datafile_array[27] = "ab";
$datafile_array[28] = "ac";
... // after "az" start with "ba" and so on until "zzzz"
$datafile[#] = "zzzz"; // ends with "zzzz"

Or is there another easy way to do this? Thank you.

Zach Curtis
POPULUS

    Sure. Try this:

    $char = "a";
    $char++;
    echo $char ."<BR>";

    Using that, it's not hard at all to construct a for statement to do this.

    -Ben

      Yes, that was it. Thank you very much. I put together like this:

      $datafile_array = array();
      $index = 0;
      for($alpha_char="a";$alpha_char<"zz";$alpha_char++)
      {
      $datafile_array[$index]="$alpha_char";
      echo "\$datafile_array[$index]->$datafile_array[$index]<br>";
      $index++;
      }

      Zach

        Write a Reply...