Problem with the plus sign

  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8388
  • Loc: USA

Post 3+ Months Ago

I have the following piece of PHP code posted in a topic:
PHP Code: [ Select ]
function wdates($start = 0, $amount = 10, $format = 'Y', $interval = 'Y', $decrease = true)
{
    // Determining where we should start the dates (In years)
    $start = ((is_numeric($start)) ? $start : 0);
   
    // Accomidating the AMOUNT returned accordignly to the START
    $amount += $start;
   
    // Creating an array of years {$amount} times
    for($i = $start; $i <= $amount; ++$i)
    {
        // Checking the interval to increase/decrease by
        $int = (($interval == 'D') ? 'day' : (($interval == 'M') ? 'month' : 'year'));
       
        // Checking if we are decreasing or increasing
        $loop = (($decrease == true) ? '-' : '+');
       
        // Creating the appropriate time stampe
        $tmsp = strtotime($loop . $i . ' ' . $int);
   
        // Building the date array
        $date_arr[] = date($format, $tmsp);
    }
   
    // Returning the date array
    return $date_arr;
}
  1. function wdates($start = 0, $amount = 10, $format = 'Y', $interval = 'Y', $decrease = true)
  2. {
  3.     // Determining where we should start the dates (In years)
  4.     $start = ((is_numeric($start)) ? $start : 0);
  5.    
  6.     // Accomidating the AMOUNT returned accordignly to the START
  7.     $amount += $start;
  8.    
  9.     // Creating an array of years {$amount} times
  10.     for($i = $start; $i <= $amount; ++$i)
  11.     {
  12.         // Checking the interval to increase/decrease by
  13.         $int = (($interval == 'D') ? 'day' : (($interval == 'M') ? 'month' : 'year'));
  14.        
  15.         // Checking if we are decreasing or increasing
  16.         $loop = (($decrease == true) ? '-' : '+');
  17.        
  18.         // Creating the appropriate time stampe
  19.         $tmsp = strtotime($loop . $i . ' ' . $int);
  20.    
  21.         // Building the date array
  22.         $date_arr[] = date($format, $tmsp);
  23.     }
  24.    
  25.     // Returning the date array
  26.     return $date_arr;
  27. }

The problem is, all of the plus signs (+) are stripped out of the code.

The problem is not only in the code, but with the entire post itself. If I happen to have a plus sign in the post (Like C++ or something), all of them are stripped out.

Look at this post for example... at the bottom when I'm talking about the syntax tag, there is the code example that I pasted above, those plus signs that you see here are just empty spaces on my site... how do I fix that?

Thanks in advance!
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

Post Information

  • Total Posts in this topic: 1 post
  • Users browsing this forum: No registered users and 156 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.