Page 1 of 1
Tabs get a parse error.
Posted: Thu Jan 26, 2006 3:00 pm
by nickman013
Hello,
After searching google, and finding nothing, I decided to ask it here.
Everytime I try to tab my scripts, so it is easier. I get parse errors.
If I remove the tabs It works.
The parse error is
Parse Error wrote:
Parse error: parse error, unexpected T_STRING in /home/muot/public_html/index.php on line 13
Posted: Thu Jan 26, 2006 3:36 pm
by John Cartwright
show code.
Posted: Thu Jan 26, 2006 3:59 pm
by nickman013
Code: Select all
<?
$page = "welcome.";
include('/home/muot/public_html/pages/includes/add2stat.php');
$folder = 'mainpics'; //No trailing slash
$images = array();
$handle = opendir($folder);
while ($file = readdir($handle))
{
$ext = substr($file, -3);
if ($ext == 'jpg' || $ext == 'gif' || $ext == 'png')
{
$images[] = $file; //Add the file to the array
}
}
closedir($handle);
shuffle($images); //Jumbly jumbly, shake 'em all about!
?>
If i remove that tab, it works.
Its wierd, if the code has tabs in it, it doesnt work, if there is no tabs, it works.
Thank You
Posted: Thu Jan 26, 2006 4:03 pm
by Chris Corbyn
That's just plain weird
Can I ask if you're using Macromedia dreamweaver to do your editting? It has issues with sticking invisible characters in the code for some reason (at least it used to)... it used to cause header() issues a lot.
Posted: Thu Jan 26, 2006 4:39 pm
by nickman013
I use BBEdit for macintosh.
Posted: Thu Jan 26, 2006 4:45 pm
by John Cartwright
have you tried
1) Switching editors
2) Opening in notepad or whatever mac uses to see if there are any hidden chars
Posted: Thu Jan 26, 2006 5:03 pm
by nickman013
Jcart wrote:have you tried
1) Switching editors
2) Opening in notepad or whatever mac uses to see if there are any hidden chars
1. I didnt try switching ediots, becasue this is like the best one made for mac, if you know any other good ones, please let me know.
2. It doesnt add any hidden characters.
Thank You
Posted: Thu Jan 26, 2006 5:18 pm
by feyd
maybe the tab you are inputting isn't actually a tab character?
Code: Select all
echo 'Normal tab: '.implode('',unpack('H*',chr(0x09)))."\n".'Your tab: '.implode(unpack('H*',/* put a tab inside a string here like this
: */ ' '));
functioning normally you should see:
Posted: Thu Jan 26, 2006 5:33 pm
by nickman013
Code: Select all
Warning: unpack() [function.unpack]: Type H: outside of string in /home/muot/public_html/test/test.php on line 2
Warning: unpack() [function.unpack]: Type H: outside of string in /home/muot/public_html/test/test.php on line 3
Normal tab: 09 Your tab: 20
I got to find out how to set my tabs to 09.
Thank You
Posted: Thu Jan 26, 2006 5:37 pm
by feyd
did you actually replace the character I had in my example string with a tab from your machine? Because I put a space (20) in it.

Posted: Thu Jan 26, 2006 6:14 pm
by nickman013
Oh haha, where would I put my tab in?
Posted: Thu Jan 26, 2006 6:21 pm
by feyd
read the code.. it may give you a hint.

Posted: Thu Jan 26, 2006 6:23 pm
by nickman013
Oh, I didnt understand it the first time I read it.
Code: Select all
Warning: unpack() [function.unpack]: Type H: outside of string in /home/muot/public_html/test/test.php on line 2
Warning: unpack() [function.unpack]: Type H: outside of string in /home/muot/public_html/test/test.php on line 2
Normal tab: 09 Your tab: 09
Posted: Thu Jan 26, 2006 6:35 pm
by feyd
hmmm... weird..