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
nickman013
Forum Regular
Posts: 764 Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York
Post
by nickman013 » Thu Jan 26, 2006 3:00 pm
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
nickman013
Forum Regular
Posts: 764 Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York
Post
by nickman013 » Thu Jan 26, 2006 3:59 pm
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
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098 Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia
Post
by Chris Corbyn » Thu Jan 26, 2006 4:03 pm
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.
nickman013
Forum Regular
Posts: 764 Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York
Post
by nickman013 » Thu Jan 26, 2006 4:39 pm
I use BBEdit for macintosh.
John Cartwright
Site Admin
Posts: 11470 Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:
Post
by John Cartwright » Thu Jan 26, 2006 4:45 pm
have you tried
1) Switching editors
2) Opening in notepad or whatever mac uses to see if there are any hidden chars
nickman013
Forum Regular
Posts: 764 Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York
Post
by nickman013 » Thu Jan 26, 2006 5:03 pm
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
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Thu Jan 26, 2006 5:18 pm
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:
nickman013
Forum Regular
Posts: 764 Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York
Post
by nickman013 » Thu Jan 26, 2006 5:33 pm
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
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Thu Jan 26, 2006 5:37 pm
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.
nickman013
Forum Regular
Posts: 764 Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York
Post
by nickman013 » Thu Jan 26, 2006 6:14 pm
Oh haha, where would I put my tab in?
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Thu Jan 26, 2006 6:21 pm
read the code.. it may give you a hint.
nickman013
Forum Regular
Posts: 764 Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York
Post
by nickman013 » Thu Jan 26, 2006 6:23 pm
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
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Thu Jan 26, 2006 6:35 pm
hmmm... weird..