Jump to content

Parse error - unexpected T_IS_GREATER_OR_EQUAL


keezel

Recommended Posts

Hello all.  I am terrible at PHP, but it's pretty handy and I like it far better than other languages.  I'm trying to write a program to perform some pretty simple math, but it's giving me a syntax error.  I am not familiar enough with PHP syntax to know why.

 

Here is the code:

 

<?php

$variable = 14;
$TaxesPaid;
$OneBracket1 = 1;
$OneBracket12 = 12;
$OneBracket22 = 22;
$OneBracket32 = 32;
$OneBracket42 = 42;
$OneBracket52 = 52;

if($variable <= $OneBracket1):
$TaxesPaid = $variable * 0.10;
elseif($variable <= $OneBracket12 && >= $OneBracket1):
$TaxesPaid = $variable * 0.15;
elseif($variable <= $OneBracket22 && >= $OneBracket12):
$TaxesPaid = $variable * 0.25;
elseif($variable <= $OneBracket32 && >= $OneBracket22):
$TaxesPaid = $variable * 0.28;
elseif($variable <= $OneBracket42 && >= $OneBracket32):
$TaxesPaid = $variable * 0.33;
elseif($variable >= $OneBracket52):
$TaxesPaid = $variable * 0.35;
else:
    echo "death"

echo $TaxesPaid;


?>

 

Here is the error I'm receiving:

 

Parse error: syntax error, unexpected T_IS_GREATER_OR_EQUAL in (local directory) on line 16

 

I tried writing the same snippet of code with { }'s instead of : to separate the if clauses but I'm getting the same error.  It appears to be an error with the comparison operators ( >=, &&, <=).  I tried switching some of these around, like =>, and received a different error.  I think the latter (=>) is more for arrays than if statements.

 

Any guidance would be extremely appreciated!  I've been wrestling with this for awhile now...

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.