Im trying to loop through the $files array and:
- Find occurrences of "some-string".
- For every "some-string" occurrence found, i need to add it to an array. (ie. $some_strings).
-
Finally be able to call $some_string array outside of the for loop for manipulation(ie. count(), $some_string[1])
foreach($files as $key=>$value) { if(strstr($value,'some-string')){ $some_strings = array(); $some_strings = $files[$key]; unset($files[$key]); } elseif (strstr($value,'php')) { unset($files[$key]); } }
Every things seems to work fine until i try count($some_strings). This only returns 1 value when i know there are atleast 10 values. WHat am i doing wrong?