i keep getting parse errors on the last line of this how ever i cannot seem to find the mistake .. any help ?

Parse error: parse error, unexpected T_STRING in /home/content/mydir/index.php on line 103

(i added the line numbers jsut for the post not actually in code)

96 $info2 = pathinfo($_SERVER['PHP_SELF']);
97 $split = split('/', $info2['dirname']);
98 $basedir = $split[count($split)-1];
99
100 $info = $info2['dirname'] == '\' ? "" : $info2['dirname'];
101
102
103 $basedir = $basedir == '\' ? '' : $basedir;

Recommended Answers

All 2 Replies

Try clarifying your ternary statements with parenthesis and see if that helps:

$info = ($info2['dirname'] == '\') ? "" : $info2['dirname'];

$basedir = ($basedir == '\') ? '' : $basedir;

Actually it's the slash that causes trouble:

$info = ($info2['dirname'] == '\\') ? "" : $info2['dirname'];
 
$basedir = ($basedir == '\\') ? '' : $basedir;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.