0

The following code prints an array of values where whatever is written in MySearchField is found in the values of $FullLinks:

<?
function myFilter($string) {
return strpos($string,'MySearchField') !== false;
}

$newArray = array_filter($FullLinks, 'myFilter');
?>

<pre> <? print_r($newArray); ?> </pre>

However, if I use a variable instead then it won't show any values. For example:

return strpos($string,$MySearchField) !== false;

Can anyone tell me how I can get the search word from a variable instead?

Any actual answers would be really appreciated. I have no idea how to use the variable scope article posted.

user2803146
  • 137
  • 3
  • 14

0 Answers0