I have a .js file with code compatible for both php and js languages. The file is read and edited by php and then fetched by JS. so the extension is JS, is there any way that i can require this file in my php script and the file may execute normally as a require/include would work on a .php file.
I dont want to Eval the file contents in PHP because Eval is time costly and risky.
SO is there any way to include/require non php extension files as a php file ?
edit : the files content are similar to the text below, this file is read/written by php and then included in my page via simple js file inclusion as
$my_array = Array();
$my_array['id_01'] = 100;
hmmm, yes it is possible but I suspect your code is NOT compatible. Include/require works regardless of what the file extension is.
You seem to think it’s not compatible either.
Your post is so confused its hard to tell what you’re really trying to achieve here – but the following code is valid in both languages and would execute where the relevant functions are defined: