?
Solved

Call to undefined function: array()

Posted on 2003-03-19
4
Medium Priority
?
591 Views
Last Modified: 2008-03-17
I keep getting this error: Call to undefined function: array() on line 17

Here is my code, and I have star'ed line 17.  I have no clue why it tells me this...

<BODY onLoad="setInterval('opennext()',10000)">
<?php
     $sites=file("sites.txt");
     if(count($sites)==0){
          echo "Sorry!  There was an error loading sites.txt";
     }
?>


<script language=javascript>
popups=new Array()
<?php
$ads=count($sites);
for($x=0;$x<$ads;$x++){

*******echo "popups" . chr(91) . $x . chr(93) . "=" . chr(34) .$sites(x) . chr(34);*******  <---Line 17

}
?>
current=0

function opennext(){
myVar=window.open(popups[current])
if (current<popups.length){
current++
}
else{
current=0
}
}
0
Comment
Question by:bomax
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 2

Accepted Solution

by:
bobsledbob earned 200 total points
ID: 8170694

I think you're probably looking to use $sites[x] (with brackets) not $sites(x) (with paranthesis), right?


*******echo "popups" . chr(91) . $x . chr(93) . "=" . chr(34) .$sites[x] . chr(34);*******  <---Line 17

0
 

Author Comment

by:bomax
ID: 8170825
Thanks, that did it.  Somehow I missed it!

But now I get an error on line 6:

echo "Sorry!  There was an error loading sites.txt";

Error is: Expected ';'

Any ideas?

-Matt
0
 
LVL 2

Expert Comment

by:bobsledbob
ID: 8170941

hmm, no idea.  I copied that block of code and it ran just fine for me.

0
 

Author Comment

by:bomax
ID: 8171014
Anyone else know what might be causing my new error? Because I am definitely getting one and it does not work.
0

Featured Post

WordPress Tutorial 2: Terminology

An important part of learning any new piece of software is understanding the terminology it uses. Thankfully WordPress uses fairly simple names for everything that make it easy to start using the software.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question