title: how to use Codemirror.on('change') to save only changed using PHP?
body: <p>I need use the changes only, not all the text, to provide server resources and service user.
  see <a href="https://stackoverflow.com/questions/19744118/code-mirror-get-text-around-changes">Code Mirror: Get Text Around Changes</a></p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;textarea id="code"&gt;script.js&lt;/textarea&gt;
  </code></pre>
  
  <p>JavaScript:</p>
  
  <pre><code>var id = document.getElementById("code");
  var options = {mode:'javascript'};
  var editor = CodeMirror.fromTextArea(id, options);
  editor.on("change",function(cm,change){
      $.ajax({
          url:'update.php',
          method:'POST',
          data:{
              save:true,
              file:'script.js',
              update:change
          },
          success:function(data){
              console.log(data);
          }
      });
  });
  </code></pre>
  
  <p>PHP:</p>
  
  <pre><code>if(isset($_POST['save']) &amp;&amp; $_POST['save'] === true){
      if(isset($POST['file']) &amp;&amp; file_exists($POST['file'])){
          $file = file_get_contents($POST['file']);
          if(isset($POST['update']) &amp;&amp; !empty($POST['update'])){
              $change = @json_decode(@json_encode($_POST['update']));
              //here how to use data from $change to update file script.js?
          }
      }
  }
  </code></pre>
  
  <p>!!</p>