Jump to content

Simple Parse error


Michdd

Recommended Posts

if($range <= 15){
										$lvlamm = 5;
										$repamm = 25;
										} elseif($range => -15) {
											$lvlamm = 5;
											$repamm = 25;
											} elseif($range <= 30){
												$lvlamm = 4;
												$repamm = 20;
												} elseif($range => -30){
													$lvlamm = 4;
													$repamm = 20;
													} elseif($range <= 40){
														$lvlamm = 3;
														$repamm = 15;
														} elseif($range => -40){
															$lvlamm = 3;
															$repamm = 15;
															} else {
																$lvlamm = 1;
																$repamm = 5;
															}

 

Error:

 

Parse error: syntax error, unexpected T_DOUBLE_ARROW in /home/a8943039/public_html/usercp.php on line 457

 

Line:

 

										} elseif($range => -15) {

Link to comment
https://forums.phpfreaks.com/topic/134837-simple-parse-error/
Share on other sites

Looking at your code you have a bit of duplication. It could be written as:

f($range >= -15 || $range <= 15)
{
    $lvlamm = 5;
    $repamm = 25;
}
elseif($range >= -30 || $range <= 30)
{
    $lvlamm = 4;
    $repamm = 20;
}
// etc

Link to comment
https://forums.phpfreaks.com/topic/134837-simple-parse-error/#findComment-702200
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.