Jump to content

Php5 And Substr Problem


seeder.us

Recommended Posts

I'm having a problem with the following code

 

My problem is i want to limit characters from $file, how can limit

 

[HorribleSubs]_YuruYuri_S2_07_[480p].mkv.qt.mp4

 

into

 

[HorribleSubs]_YuruYuri...

 

 

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);
}
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.