473,396 Members | 1,933 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Wrong datatype for second argument

15
This is my script for counting file size in folders, but when I put this script on normal text page it shows error:
Warning: in_array() [function.in-array]: Wrong datatype for second argument in statistics.php on line 20


Expand|Select|Wrap|Line Numbers
  1. <?php
  2. if (session_id() == ""){
  3. session_start();
  4. }
  5. $maxupload=1024000000; // in byte
  6. $dir='jdownloads';
  7. $notcount=array('index.html','listing.php','descriptionfile.txt');
  8. dirs($dir);
  9. $sizeinbyte=($_SESSION[tots]==0)?'0':$_SESSION[tots];
  10. $_SESSION[tots]=array();
  11. unset($_SESSION[tots]);
  12. function dirs($dir){
  13. global $notcount;
  14. if ($handle = opendir($dir)) {
  15. while (false !== ($file = readdir($handle))) {
  16.  if ($file != "." && $file != "..") {
  17. if(is_dir($dir.'/'.$file)){
  18. dirs($dir.'/'.$file);
  19. }else{
  20. if (!in_array($file, $notcount)) {
  21. $fl=filesize($dir.'/'.$file);
  22. $_SESSION[tots]=$_SESSION[tots]+$fl;
  23. }
  24. }
  25. }
  26. }
  27. closedir($handle);
  28. }
  29. }
  30. ?>
Aug 22 '10 #1

✓ answered by TheServant

Yeah I am just checking that your PHP is working as expected.

3 2081
TheServant
1,168 Expert 1GB
I can't see why that is not working. Please try a simple script:
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $os = array("Mac", "NT", "Irix", "Linux");
  3. if (in_array("Irix", $os)) {
  4.     echo "Got Irix";
  5. }
  6. if (in_array("mac", $os)) {
  7.     echo "Got mac";
  8. }
  9. ?>
If this works, modify it by parts to get it to look like your code running it after every change. That way you should be able to pin point where there is a problem.
Aug 23 '10 #2
dada1
15
your script is not doing the same what mine do
Aug 23 '10 #3
TheServant
1,168 Expert 1GB
Yeah I am just checking that your PHP is working as expected.
Aug 23 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: News Central | last post by:
To all! I use the DateDiff function using VB6 and get this error 'Wrong number of argument or invalid property assignment' ... have anyone seen this problem? thanks ....
6
by: Raoul | last post by:
It appears that matrixmultiply(A,B) has a side-effect of transposing the second argument (B). Is this supposed to happen? Is there anyway to prevent it from transposing? This shows what...
5
by: Tobiah | last post by:
What is the purpose of the second argument to super()? What is meant by the returning of an 'unbound' object when the argument is omitted. Also, when would I pass an object as the second...
4
by: exits funnel | last post by:
Hello, I'm working my way through 'Thinking in C++' by Bruce Eckel. One of the exercises and the end of chapter 12 is the following: > Create a class with an assignment operator that has a...
13
by: Imre | last post by:
Please take a look at the following code: template <typename T, typename Enable = void> class A { public: enum { value = 0 }; }; template <typename T>
1
by: Manch | last post by:
I need to dynamically retrieve the column index of a Windows Forms datagrid column. To reference the column I used the following code ...
1
usafshah
by: usafshah | last post by:
Warning: in_array() : Wrong datatype for second argument in \tickets\functions_ticketsui.php on line 196 Can Any one tell me what this warning means ?
3
by: Sonnich | last post by:
The following code is an exact copy of my current code. The idea is to check 2 parts (of string arrays), and add those only once to a common array. I check for existance of an array in a string,...
16
by: SirG | last post by:
I'm looking for an explanation of why one piece of code works and another does not. I have to warn you that this is the first piece of Javascript I've ever written, so if there is a better way or a...
30
by: Adam | last post by:
Hi, I have a simple printf-like function: int print(const char *format, ...) { char buffer; va_list argptr; int i;
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.