Community
    • Login

    Why does NP++ reformat my php code?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    2 Posts 2 Posters 2.2k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Michael TriglianosM
      Michael Triglianos
      last edited by

      Why does notepad++ reformat my script. I opened my script yesterday and everything was double-spaced. Today I opened it and it was all jumbled up, like this:

      $todaynbr = date("d");	$today = date("Y-m-d");	$monDays = cal_days_in_month(CAL_GREGORIAN, $monthnbr, $year);	$firstday = date("w", mktime(0, 0, 0, $monthnbr, 1, $year)); 	$lastday = date("t", mktime(0, 0, 0, $monthnbr, 1, $year)); 	$num_of_weeks = 1 + ceil(($lastday-7+$firstday)/7);	$dateObj   = DateTime::createFromFormat('!m', $monthnbr);	$monname = $dateObj->format('F'); 		$firstdayofMonth = date("l", mktime(0, 0, 0, date("$monthnbr"), 1, date("$year")));	$day_of_week = date('N', strtotime($firstdayofMonth));
      $tgl = '01' . $monname . $year;	$lastMonth = date("M Y",mktime(0,0,0,date("m", strtotime($tgl))-1,1,date("Y", strtotime($tgl))));	$lmonth = date('m',strtotime($lastMonth));	$nextMonth = date("M Y",mktime(0,0,0,date("m", strtotime($tgl))+1,1,date("Y", strtotime($tgl))));	$nmonth = date('m',strtotime($nextMonth));
      $string="$lastMonth";	$last_space = strrpos($string, ' ');	$last_yr = substr($string, $last_space);	$last_mon = substr($string, 0, $last_space);
      

      The script still work but why doesn’t it just leave the damn code alone? Editing it is a pain in the ass if I have to reformat 400 lines manually.

      1 Reply Last reply Reply Quote 0
      • dailD
        dail
        last edited by

        Notepad++ does not mess with any code like that. Either you:

        • Have a plugin that is somehow modifying the code
        • Are accidentally hitting a shortcut key (e.g. Ctrl+J to join all the lines)
        • Or something outside of Notepad++ is modifying it (for example mixing up line endings)
        1 Reply Last reply Reply Quote 0
        • First post
          Last post
        The Community of users of the Notepad++ text editor.
        Powered by NodeBB | Contributors