Unexpected $ error, can not find error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
blueplazma
Forum Newbie
Posts: 1
Joined: Wed Aug 17, 2005 11:53 pm

Unexpected $ error, can not find error

Post by blueplazma »

I have narrowed an "unexpected $" error on the last line of a script down to the following block of code, but I can not find any errors in it. Perhaps another set of eyes would help. Thanks.

Code: Select all

function process_directory($dir_name,$func_name,$max_depth = 10,$depth = 0,$func_var) {
                if ($depth >= $max_depth) {
                        error_log("Reached max depth $max_depth in $dir_name\.");
                        return false;
                }
                $subdirectories = array();
                $files = array();
                if (is_dir($dir_name) && is_readable($dir_name)) {
                        $d = dir($dir_name);
                        while (false !== ($f = $d->read())) {
                                // skip . and ..
                                if (('.' == $f) || ('..' == $f)) {
                                        continue;
                                }
        `                       if (is_dir("$dir_name/$f")) {
                                        array_push($subdirectories,"$dir_name/$f");
                                } else {
                                        $func_name("$dir_name/$f","$func_var");
                                }
                        }
                        $d->close();
                        foreach ($subdirectories as $subdirectory) {
                                process_directory($subdirectory,$func_name,$max_depth,$depth+1,$func_var);
                        }
                }
                return true;
        }
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

is that backtick in your code? (middle of the whitespace area on the left side.)
Post Reply