0

Title is pretty much self explanatory...

Here is my code :

$myVars=file_get_contents('1.php');

highlight_string($myVars);

$ignore=array('GLOBALS', '_FILES', '_COOKIE', '_POST', '_GET', '_SERVER', '_ENV');
$myVars=array_diff_key(get_defined_vars()+array_flip($ignore),array_flip($ignore));

exit;

I'm trying to fetch all variables (except php predefined variables) into an array.

Small tweak needed here :)

Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055
iprophesy
  • 175
  • 3
  • 9
  • 2
    use include() and get your vars. file_get_contents() will give you contents – Rakesh Sharma Jan 05 '15 at 13:01
  • 2
    Questions seeking debugging help must not only include the shortest code necessary to reproduce the problem and the desired behavior, but also a specific problem or error. So, please explain what's wrong with your code. In how far is the output different from the output you want? – honk Jan 05 '15 at 13:02
  • @Rakesh Sharma I want to obfuscate the variables therefore I can't use include. I do not want to run the code just fetch all variables and obfuscate them. – iprophesy Jan 05 '15 at 13:03
  • @iprophesy Without an include i don't think you can do that, but with an include it's pretty easy – Rizier123 Jan 05 '15 at 13:11
  • 1
    @iprophesy: This is helpful context. Next time please include context information into your question right from the start. Otherwise we might run into an [XY problem](http://meta.stackexchange.com/questions/66377/what-is-the-xy-problem) here. – honk Jan 05 '15 at 13:13
  • @honk You are right :) I assumed that it would be easier... – iprophesy Jan 05 '15 at 13:24

0 Answers0