2

I'm going crazy about this error. This is my Code:

if ( $result != "Ball In Play" ) {
  // If Pitch Is A Ball
  if ( $result == "Ball" ) {
    $balls += 1;
    // Check If Batter Is Walked
    if ( $balls == 4 ) {
      $this->concludeAtBat( "Walk", "" );
    }
    // Update Balls Count
    update_post_meta( $this->ID, "balls", $balls );
  }

I'm getting this

Error: Parse error: syntax error, unexpected '$result' (T_VARIABLE) in /Applications/XAMPP/xamppfiles/htdocs/.../file.php on line 261

Line 261 is:

if ( $result == ball ){

Can somebody tell me what I'm missing? Thank you for your help.

rndus2r
  • 496
  • 4
  • 17
  • 1
    Did you mess up with some invisible characters maybe? – rndus2r Sep 28 '17 at 22:38
  • 1
    Is that ALL of the code in your file.php? What else is around it? It could be a result of an error elsewhere... FYI you are missing a closing } in the code you have provided. – TimBrownlaw Sep 28 '17 at 22:46
  • 1
    Thanks for your answers. I don't know what the problem was. I think there were some invisible characters. I just rewrote the code, now it works. – Graf Koks Persoenlich Sep 28 '17 at 22:50
  • Unless you defined `ball` as a constant then you were missing either a `$` to make it a variable or quotes around it to make a string (`$result == ball`). – Mike S Sep 29 '17 at 00:04

0 Answers0