Unexpected T_STRING

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

adamb10
Forum Commoner
Posts: 91
Joined: Sat Jun 24, 2006 7:44 pm

Post by adamb10 »

I have syntax highlighting but I have no idea what the colors mean.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

adamb10 wrote:I have syntax highlighting but I have no idea what the colors mean.
I'm sure if you look over it you'll see ;)

Look at ours:

Code: Select all

$variable_is_blue = "string is red"; //comments are orange

/*
 Syntax is green (i.e. =, *, &, [ ] () )
 Keywords are green (i.e. function, while, do, for, foreach, if, else)
 */

if ($foo) echo "foo is here!";
basdog22
Forum Contributor
Posts: 158
Joined: Sun Nov 30, 2003 3:03 pm
Location: Greece

Post by basdog22 »

d11wtq wrote:That's not the problem. This is (it can be seen clearly from the highlighter).

Code: Select all

if($row['links != "images"){
            echo '<a href="'.$website.'">[website]</a>';
            } else {
Should be:

Code: Select all

if($row['links'] != "images"){
            echo '<a href="'.$website.'">[website]</a>';
            } else {
either way his escaping had problems... and i think

Code: Select all

"html here".$var."more html"
is easier looking at than

Code: Select all

'html"'.$var.'"more html'
oh and i use PEAR's way too...

Code: Select all

if($cond){
 //do stuff
}
adamb10
Forum Commoner
Posts: 91
Joined: Sat Jun 24, 2006 7:44 pm

Post by adamb10 »

I have elected to use PEAR's way even though the phpBB way would be easier. I cant believe how much nicer my code is now...

Code: Select all

if ($aim != ""){
    if ($row['links'] != "images") {
        echo " <a href=\"aim:goim?screenname=$aim&message=Hello\">[aim]</a>";
     } else {
           echo '<a href="aim:goim?screenname='.$aim.'&message=Hello"><img src="'.$row2['aim'].'" border="0"></a>';
       }
}
Post Reply