AndrewGSW
08-10-2012, 09:06 PM
I have saved my JS file as a text file. I use four spaces for the indenting and if I open the file in a text editor these spaces are intact. But when I use file_get_contents() print_r confirms that often these spaces are doubled-up to eight.
Has anyone encountered this and know of a solution? Here's my code for reference:
if (file_exists('includes/AndyG_js.txt')) {
$mylib = file_get_contents('includes/AndyG_js.txt');
} else {
$mylib = 'File not found, unfortunately! Contact the administrator of this site.';
}
print_r($mylib);
echo <<< THECODE
<pre class="prettyprint"><code class="language-javascript">{$mylib}
}</code></pre>
THECODE;
Has anyone encountered this and know of a solution? Here's my code for reference:
if (file_exists('includes/AndyG_js.txt')) {
$mylib = file_get_contents('includes/AndyG_js.txt');
} else {
$mylib = 'File not found, unfortunately! Contact the administrator of this site.';
}
print_r($mylib);
echo <<< THECODE
<pre class="prettyprint"><code class="language-javascript">{$mylib}
}</code></pre>
THECODE;