Okay, so I'm using require_once to load the contents of a .js file. However, there seems to be a 1
added to the end of the file after the require is done.
PHP:
echo require_once("test.js");
JS:
var newFunc = function() {
console.log('yay!');
};
rendered html when the PHP file is loaded:
var newFunc = function() {
console.log('yay!');
};1
require_once() returns 1 if the include was successful. So you're echoing the return value, which is not what you thought it was.
Use file_get_contents() instead, although this is odd usage, you're probably heading in the wrong direction with whatever you're trying to do with this...