Problème avec le signe plus

  • Bogey
  • Bogey
  • Genius
  • Avatar de l’utilisateur
  • Inscription: Juil 14, 2005
  • Messages: 8212
  • Loc: USA
  • Status: Offline

Message Février 15th, 2010, 2:26 am

J'ai le morceau suivant de code PHP publiée dans une rubrique:
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. }

Le problème est que tous les signes plus (+) sont supprimés du code.

Le problème n'est pas seulement dans le code, mais avec l'ensemble du poste lui-même. S'il m'arrive d'avoir un signe plus dans le poste (comme C + + ou quelque chose), tous sont supprimés.

Regardez ce poste par exemple...au fond quand Im parler de la balise de syntaxe, il ya l'exemple de code que j'ai collé ci-dessus, ces signes plus que vous voyez ici sont juste des espaces vides sur mon site...comment puis-je résoudre ce problème?

Merci d'avance!
"Bring forth therefore fruits meet for repentance:" Matthew 3:8
  • Anonymous
  • Bot
  • No Avatar
  • Inscription: 25 Feb 2008
  • Messages: ?
  • Loc: Ozzuland
  • Status: Online

Message Février 15th, 2010, 2:26 am

Afficher de l'information

  • Total des messages de ce sujet: 1 message
  • Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 186 invités
  • Vous ne pouvez pas poster de nouveaux sujets
  • Vous ne pouvez pas répondre aux sujets
  • Vous ne pouvez pas éditer vos messages
  • Vous ne pouvez pas supprimer vos messages
  • Vous ne pouvez pas joindre des fichiers
 
 

© 2011 Unmelted, LLC. Ozzu® est une marque déposée de Unmelted, LLC