I need to get the value of a variable which is present in another file. I know I can use the include or the require function but in both the cases it prints out the entire output which is present in the file which was included. So is there a way around to get only the values of the variables and not the output from another file ?
Share
Your variable should now be available in scope.
Of course if you care about the output, you may want to keep it:
This is with the caveat that you should never do this if you are the designer of the whole app. Instead, set up all the variables in one file and use a separate one to generate output. Ideally look into an MVC architecture where the controller sets the variables and view/template does the output.