Prob with function

This is my first php script that I wrote by myself. It reads the directory and outputs the strings into the webpage. The purpose is so I don't have to create hyperlinks everytime I add a new file to my website. I set up variable of files that I don't want included as a hyperlink. But I'm getting this stupid error and I can't figure out what hte problem is. Here's my code, and the error I'm getting will follow the code:



Parse error: parse error, expecting `')'' in /****/www/test.php3 on line 6

<?php

/*Function to check if value should go into webpage as hyperlink or not*/
function checkformatches($d, $c[], $num)) {
$val=0;
for($k=0; $k<=$num; $k++){
if($d=$c[$k]){
$val=1;
echo "yes
";
}
}
return $val;
}

/*These vars are here so they DONT get added as a hyperlink*/
$check[] = "test.php3";
$check[] = "index.php3";
$check[] = ".";
$check[] = "..";
$check[] = "core";
$check[] = "header.inc";
$count=0;
$handle = opendir('.');
while($entry = readdir($handle)) {
$dir[]=$entry;
$count++;
}
closedir($handle);


$i=0;
while($i <= $count){
if checkformatches($dir[$i], $check[], $i)=0{
echo "$dir<br>
";/*This is where the hyperlink will go, I'll finish when the rest of the code works*/
i++;
}

?>

Comments

  • Ignore the two "(("'s on line 6, there was only one there when I got the error, me thinks the error shouldn't be there.


    : This is my first php script that I wrote by myself. It reads the directory and outputs the strings into the webpage. The purpose is so I don't have to create hyperlinks everytime I add a new file to my website. I set up variable of files that I don't want included as a hyperlink. But I'm getting this stupid error and I can't figure out what hte problem is. Here's my code, and the error I'm getting will follow the code:
    :
    :
    :
    : Parse error: parse error, expecting `')'' in /****/www/test.php3 on line 6
    :
    : <?php
    :
    : /*Function to check if value should go into webpage as hyperlink or not*/
    : function checkformatches($d, $c[], $num)) {
    : $val=0;
    : for($k=0; $k<=$num; $k++){
    : if($d=$c[$k]){
    : $val=1;
    : echo "yes
    ";
    : }
    : }
    : return $val;
    : }
    :
    : /*These vars are here so they DONT get added as a hyperlink*/
    : $check[] = "test.php3";
    : $check[] = "index.php3";
    : $check[] = ".";
    : $check[] = "..";
    : $check[] = "core";
    : $check[] = "header.inc";
    : $count=0;
    : $handle = opendir('.');
    : while($entry = readdir($handle)) {
    : $dir[]=$entry;
    : $count++;
    : }
    : closedir($handle);
    :
    :
    : $i=0;
    : while($i <= $count){
    : if checkformatches($dir[$i], $check[], $i)=0{
    : echo "$dir
    ";/*This is where the hyperlink will go, I'll finish when the rest of the code works*/
    : i++;
    : }
    :
    : ?>
    :


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories