jwer78 Posted August 12, 2007 Share Posted August 12, 2007 Im not sure why Im getting this error but it says unexpected t encapsed and whitespace expecting ']' line 58. This script works fine on another site I used it on so Im kinda baffled. Any ideas what it could be? Bold is the line 58 Thanks in advance for($count=0;$count<$teams_division[$div];$count++){ if($count%2==0) $back = 'cccccc'; else $back = 'FFFFFF'; echo "<tr>"; [b]echo "<td width=100 align=left>' . $team_name[$old_count+$count] . '</td>";[/b] echo "<td width=15 align=center>' . $wins[$old_count + $count] . '</td>"; echo "<td width=15 align=center>' . $loses[$old_count + $count] . '</td>"; echo "<td width=15 align=center>' . $ties[$old_count + $count] . '</td>"; } $old_count += $teams_division[$div]; Quote Link to comment https://forums.phpfreaks.com/topic/64465-unexpect-t-encapsed-and-whitespace/ Share on other sites More sharing options...
balistic Posted August 12, 2007 Share Posted August 12, 2007 remove the spaces.. echo "<td width=100 align=left>' . $team_name[$old_count+$count] . '</td>"; like echo "<td width=100 align=left>'.$team_name[$old_count+$count].'</td>"; if you want spaces actually in it then add them in the strings. Quote Link to comment https://forums.phpfreaks.com/topic/64465-unexpect-t-encapsed-and-whitespace/#findComment-321389 Share on other sites More sharing options...
cooldude832 Posted August 12, 2007 Share Posted August 12, 2007 Its your quotes I think. You start with a double then use single to contatation wtih variables keep it with double quotes i.e echo "<td width=100 align=left>".$team_name[$old_count+$count]."</td>"; Quote Link to comment https://forums.phpfreaks.com/topic/64465-unexpect-t-encapsed-and-whitespace/#findComment-321416 Share on other sites More sharing options...
balistic Posted August 12, 2007 Share Posted August 12, 2007 echo('<td width=100 align=left>'.$team_name[$old_count+$count].'</td>'); thats probably what it was good spotting Quote Link to comment https://forums.phpfreaks.com/topic/64465-unexpect-t-encapsed-and-whitespace/#findComment-321417 Share on other sites More sharing options...
cooldude832 Posted August 12, 2007 Share Posted August 12, 2007 echo isn't a function its a language construct/dynamic thus using the () will only supply errors Quote Link to comment https://forums.phpfreaks.com/topic/64465-unexpect-t-encapsed-and-whitespace/#findComment-321420 Share on other sites More sharing options...
balistic Posted August 12, 2007 Share Posted August 12, 2007 no it wont, its not needed that is true, but its certainly not going to error. i like it that way to see openings and endings easier. Quote Link to comment https://forums.phpfreaks.com/topic/64465-unexpect-t-encapsed-and-whitespace/#findComment-321427 Share on other sites More sharing options...
cooldude832 Posted August 12, 2007 Share Posted August 12, 2007 actually on strict it will error because it will be considered declared as a function. Note: Because this is a language construct and not a function, it cannot be called using variable functions right off php.net they use quotes, but as of strict version of 5 and i believe through 6s release you can not call it with () to prevent all issues that might be unforseen Quote Link to comment https://forums.phpfreaks.com/topic/64465-unexpect-t-encapsed-and-whitespace/#findComment-321430 Share on other sites More sharing options...
balistic Posted August 12, 2007 Share Posted August 12, 2007 Ah your right sorry Quote Link to comment https://forums.phpfreaks.com/topic/64465-unexpect-t-encapsed-and-whitespace/#findComment-321435 Share on other sites More sharing options...
cooldude832 Posted August 12, 2007 Share Posted August 12, 2007 it shouldn't error and it was right at a time, but now its frowned apon because you might have created your own function echo with that being params for it. Quote Link to comment https://forums.phpfreaks.com/topic/64465-unexpect-t-encapsed-and-whitespace/#findComment-321436 Share on other sites More sharing options...
balistic Posted August 12, 2007 Share Posted August 12, 2007 that makes sense you wouldnt happen to know the solution to my switch problem? Quote Link to comment https://forums.phpfreaks.com/topic/64465-unexpect-t-encapsed-and-whitespace/#findComment-321439 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.