too long

I made a wordpress plugin that sends emails. I would like to send a table as message in the email. If I try to write every row one by one it works, but it is not if I try this:

for ($i=01; $i < 25; $i++) {
$from = $i-1;
$to = $i ;
$message.= '<th scope="col">' . $from . ' - ' . $to . '</th>';

How can I make it work? I would appreciate if someone guide me about that.

You wanna make sure you are setting the $message variable before incrementing its value.

You cannot increment the value of a variable if it does not exist.

For example:

# Invalid
$i++; // NOTICE Undefined variable: i on line number 2

# Valid
$i = 0;
$i++;

The same goes for a string. So your code should look something like this:

<?php

# Set the $message variable
$message = "";

for( $i = 0; $i < 25; $i++ ) {
  $from = $i - 1;
  $to = $i;

  $message .= "<th scope=\"col\">$from - $to</th>"; # now increment it.

} # Make sure to close your for loop