Status
Not open for further replies.
ye strstr would be even better/faster.

just a short example, what to put in the foreach loop:

if(strstr($string,''.$file.'')){$count.=$count+1;}

now i don't have time, but maybe later if i will be free i will take a better look at it. ;)
 
try this one:

function tastro($d,$dd){
$n=0;
foreach($d as $k => $v){
if($v==$dd){$n++;}
}
return $n;
}

$a=array(10,20,10,30,40,10);
echo tastro($a,10); //will echo '3'
 
i will be back in about 30min - 1h. so cya then, if you won't figure it out yourself i will show you how to later for your case. ;) bye
 
back already, thought i would be away longer. also...

after this function use array_unique(); to get only 1. ;)

and to be sure that all will be removed, use strtolower(); before you insert it into array_unique();
 
my code already makes unique :/ egnore his code :/

you just have to loop the array and include the file with the file_get_contents function, and show how you wish

the only other command you should be looking at is array_slice or array_reduce to limit the loop to 10!
 
litewarez can you give some piece of code how to do it...

My current one,which is not calculating the duplicates (with no $total++ for every duplicate)

PHP:
 		  function RecurseFolderLister($d) 
{ 
    $BasePath = realpath($d); 
    $Storage = array(); 
     
    if(is_dir($BasePath)) 
    { 
        $resource = opendir($BasePath); 
        while(false !== ($directory = readdir($resource))) 
        { 
            if(is_dir($BasePath . '/' . $directory) && !in_array($directory,array('.','..'))) //DirCheck the TypeCheck 
            { 
                $Storage = array_merge($Storage,RecurseFolderLister($BasePath . '/' . $directory)); 
            }else 
            { 
                if(is_file($BasePath . '/' . $directory) && substr($directory,-3) == 'txt') 
                { 
                    //We have text file 
                    $key = ($BasePath . '/' . $directory); 
                     
                    if(!isset($Storage[$key])) 
                    { 
                        $Storage[$key] = 0; 
                    } 
                    $Storage[$key]++; 
                } 
            } 
        } 
    } 
    return $Storage; 
} 
$Storage = RecurseFolderLister('fav'); 
asort($Storage); 
$i = 0; 
foreach( array_reverse($Storage) as $filename => $total ) 
{ 
$filenames=file_get_contents($filename);
$filenames=explode("</b>", $filenames);
$filenames=array_unique($filenames);
$entry_arrayz[ 'entry' ]  .=  $filenames[0] . '('.$total.').<br />' ;
     $i++; 
     if($i == 10) break; 
}

Result:
Le Mans 24 Hours Race For 78th time ! (1).
Short Of Love [2009] DVDRip (1).
Wild Side - Speed Devil (2010) (1).
Le Mans 24 Hours Race For 78th time ! (1).
The Good guy (2009) DVDRip (1).
Le Mans 24 Hours Race For 78th time ! (1).
The Good guy (2009) DVDRip (1).
Short Of Love [2009] DVDRip (1).
Wild Side - Speed Devil (2010) (1).
The Good guy (2009) DVDRip (1).

:S
 
How do i do this loop array man ?
And isn't if($i == 10) break; doing the job for limiting to 10 ?

I've tried google but nothing substantially...
 
Status
Not open for further replies.
Back
Top