What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Can someone edit this script?

Pages: (3): « First « 1 2 [ 3 ] Last »
Can someone edit this script?
Author: Message:
.Roy
Veteran Member
*****

Avatar

Posts: 1526
Reputation: 11
20 / Male / –
Joined: Aug 2004
O.P. RE: Can someone edit this script?
look at my edited post. It still has a bug i think
03-26-2005 02:32 PM
Profile PM Web Find Quote Report
segosa
Community's Choice
*****


Posts: 1407
Reputation: 92
Joined: Feb 2003
RE: Can someone edit this script?
code:
function count_files($dir){
$dh = opendir($dir);
$files = array();
while (false !== ($filename = readdir($dh))) {
$files[] = $filename;
}
sort($files);
array_splice($files, 0, 2);
$filesnum = count($files);
return $filesnum;
}


Couldn't you just make that...

code:
function count_files($dir)
{
    $dh=opendir($dir);
    for($i=0;readdir($dh);$i++);
    return $i-2;
}


The previous sentence is false. The following sentence is true.
03-26-2005 07:32 PM
Profile PM Find Quote Report
Plik
Veteran Member
*****

Avatar

Posts: 1489
Reputation: 46
35 / Male / –
Joined: Jun 2004
RE: Can someone edit this script?
quote:
Originally posted by Segosa
code:
function count_files($dir){
$dh = opendir($dir);
$files = array();
while (false !== ($filename = readdir($dh))) {
$files[] = $filename;
}
sort($files);
array_splice($files, 0, 2);
$filesnum = count($files);
return $filesnum;
}


Couldn't you just make that...

code:
function count_files($dir)
{
    $dh=opendir($dir);
    for($i=0;readdir($dh);$i++);
    return $i-2;
}



Yeh, i just coppied it from another script that needs to acces the files afterwards, with out thinking about editing it down.
03-26-2005 08:00 PM
Profile PM Find Quote Report
segosa
Community's Choice
*****


Posts: 1407
Reputation: 92
Joined: Feb 2003
RE: Can someone edit this script?

quote:
Originally posted by Madman

Yeh, i just coppied it from another script that needs to acces the files afterwards, with out thinking about editing it down.

Oh, ok.. I managed to get it even more compact :p

code:
function count_files($d)
{
  for($x=opendir($d),$i=0;readdir($x);$i++);
  return $i-2;
}

The previous sentence is false. The following sentence is true.
03-26-2005 08:12 PM
Profile PM Find Quote Report
Pages: (3): « First « 1 2 [ 3 ] Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On