[SOLVED] probably stupid

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

Post Reply
User avatar
bimo
Forum Contributor
Posts: 100
Joined: Fri Apr 16, 2004 11:18 pm
Location: MD

[SOLVED] probably stupid

Post by bimo »

Now this doesn't seem like it would be aa difficult problem to solve but for the life of me I can't figure it out. Here's the code snippet:

Code: Select all

<?php
	   $langFromArray[] = "";
	   for($i = 0; $i <2; $i++) {
	   		$langFromArray[$i] = $myVars[$i];
	   }
	   
	   $langFrom = $langFromArray[0] . langFromArray[1];
	   print("This was translated from " . $langFrom ".");

?>
I keep getting this error:
Parse error: parse error, unexpected '[' in f:\student-iat\dynamic\hsphar\homework\translationservice\hermesita-d3-go.php on line 180
180 is the line inside of the for loop.

Any ideas?

holly
?>
User avatar
bimo
Forum Contributor
Posts: 100
Joined: Fri Apr 16, 2004 11:18 pm
Location: MD

Post by bimo »

I'm sorry, the error is on this line:

$langFrom = $langFromArray[0] . langFromArray[1];

which is after the for loop.

h
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

your second langFromArray doesn't have a $ infront of it.
User avatar
bimo
Forum Contributor
Posts: 100
Joined: Fri Apr 16, 2004 11:18 pm
Location: MD

Post by bimo »

Like I said, stupid. I could've sworn that it was there when I checked... Thanks.

h
Post Reply