title: Parsing data from file with PHP
body: <p>I've a strange issue with parsing data from file with file_get_contents.</p>
  
  <p>File contents: 0,0,0 (there are 3 random numbers in range from 0 to 255 separated by comma)</p>
  
  <pre><code>$s = file_get_contents($this-&gt;filePath);
  var_dump(trim($s));
  $rgb = explode(',', trim($s));
  var_dump($rgb);
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>string(8) "﻿0,0,0"
  array(3) {
    [0]=&gt;
    string(4) "﻿0"
    [1]=&gt;
    string(1) "0"
    [2]=&gt;
    string(1) "0"
  }
  </code></pre>
  
  <p>And if I try converting to integer:</p>
  
  <pre><code>string(14) "﻿255,128,255"
  array(3) {
    [0]=&gt;
    string(6) "﻿255"
    [1]=&gt;
    string(3) "128"
    [2]=&gt;
    string(3) "255"
  }
  
  echo((int)$rgb[0]); // -&gt; 0
  echo((int)$rgb[1]); // -&gt; 128
  echo((int)$rgb[2]); // -&gt; 255
  </code></pre>
  
  <p>The file is in encoding UTF-8 and I think there is some whitespace char in the parsed string, but I don't know what should I do with it, cause simple trim does not work.</p>
  
  <p>Thanks for ideas!</p>