0

I need a php function or script that can check search php code to see if certain words are used.

Example: I want to be able to search PHP files written in my own php files on my server dynamically to see if the phrase $_SESSION is used.

Rasclatt
  • 12,498
  • 3
  • 25
  • 33
Flaco_Taco
  • 85
  • 1
  • 8

1 Answers1

0

You're better of using the system function in php with grep and check the result output. Grep is a very powerful tool on Linux.

system(grep -rl "string" /path);

You can also use a built in php function to search for $_SESSION in your files.

$search_text = preg_grep($pattern, file($path));
unixmiah
  • 3,081
  • 1
  • 12
  • 26