Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #13500

Re: count() problem

From Denis McMahon <denismfmcmahon@gmail.com>
Newsgroups comp.lang.php
Subject Re: count() problem
Date 2014-05-03 22:14 +0000
Organization A noiseless patient Spider
Message-ID <lk3po2$aom$3@dont-email.me> (permalink)
References <gpqyx6uagdlf$.10osd5vpnl4mw.dlg@40tude.net> <bskr2oFbovkU1@mid.uni-berlin.de> <12gy39aq5y19e.1utiz5oozj29r$.dlg@40tude.net>

Show all headers | View raw


On Sat, 03 May 2014 15:57:26 -0400, richard wrote:

> On Sat, 03 May 2014 20:32:56 +0200, M. Strobel wrote:
> 
>> Am 03.05.2014 20:18, schrieb richard:
>>> 
>>> $dir    = '../audio/'.$yr.'/';
>>> $files = scandir($dir); $number=count(files);
>> did you mean
>>    $number=count($files);
>> ?
>> /Str.
>>> echo $number;
>>> 
>>> Why does this always show the resutlt as 1?
>>> 
>>> 
>>> $dir    = '../audio/'.$yr.'/';
>>> $files = scandir($dir);
>>> echo count(files);
>>> 
>>> Shows the true count of the array.

> thanks. many times I overlook the obvious.

Did you even think to check for any warning messages? Did you have 
warnings turned on? PHP will usually generate a warning if warnings are 
on and you appear to have left a $ off of a variable name.

-- 
Denis McMahon, denismfmcmahon@gmail.com

Back to comp.lang.php | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

count() problem richard <noreply@example.com> - 2014-05-03 14:18 -0400
  Re: count() problem "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2014-05-03 20:32 +0200
    Re: count() problem richard <noreply@example.com> - 2014-05-03 15:57 -0400
      Re: count() problem Denis McMahon <denismfmcmahon@gmail.com> - 2014-05-03 22:14 +0000
  Re: count() problem Richard Yates <richard@yatesguitar.com> - 2014-05-03 11:33 -0700
  Re: count() problem "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2014-05-03 20:36 +0200

csiph-web