检查php文件中所有变量的值

index.php file:

<?php
 include 'phpinfoip.php';
 if (in_array($_SERVER['REMOTE_ADDR'], $ip))
 if (in_array('1', $ip, true))
?>

phpinfoip.php file:

<?php
 $ip = array('127.0.0.1', '1');
?>

I would like to check one value in all variables inside the file, without having to call them by name ($ip1, $ip2... etc) to apply the following logic:

if xxx variables has the array value = 1
Run the code

In other words, I would like to get something like:

<?php
 include 'phpinfoip.php';
 if (in_array($_SERVER['REMOTE_ADDR'], $ip))
 if (in_array('1', $allvariables, true))
?>

I think this question is crazy, and maybe impossible? sorry if it's a bother. (complementary alternatives with javascript are acceptable)