Search the Community
Showing results for tags 'substr limit cher'.
-
I'm having a problem with the following code My problem is i want to limit characters from $file, how can limit into not necessary for this file above but for every single file that is being echo $file I've tried to add it by my self but so far i do not understand it fully like this if ($rest = substr("$file", -1); <?php $count = 0; if ($handle = opendir('public')) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != ".." [color=#000000][color=#0000BB] if ($rest [/color][color=#007700]= [/color][color=#0000BB]substr[/color][color=#007700]([/color][color=#DD0000]"[/color][/color]$file[color=#000000][color=#DD0000]"[/color][color=#007700], -[/color][color=#0000BB]1[/color][color=#007700]);[/color][/color] && substr($file,-strlen(".html")) != ".html" //if you don't want to include .html files, for instance && substr($file,-strlen(".jpg")) != ".jpg" //if you don't want to include .js files, for instance && substr($file,-strlen(".sh")) != ".sh" //if you don't want to include .js files, for instance && substr($file,-strlen(".srt")) != ".srt" //if you don't want to include .js files, for instance && substr($file,-strlen(".sub")) != ".sub" //if you don't want to include .js files, for instance && substr($file,-strlen("subs")) != "subs" //if you don't want to include .js files, for instance && substr($file,-strlen("png")) != "png" //if you don't want to include .js files, for instance && $file != "" ) {$count++; print(" <div class=\"related\"><ul> <a href=\"http://$get_domain/play.php?url=http://$get_domain/public/$file\" title=\"$file\"><li> <img src=\"http://$get_domain/public/$file.png\" style=\"width:60px; height:50px; float:left; margin-right:6px; border:0;\"> $file<br /> <span class=\"detail\">5,432,128 views</span> </li></a> \n"); } } closedir($handle); } ?>