1

PHP is giving me a parse error here.

if ($detalleReserva->isGratis() || $detalleReserva->isPasajeroSinCosto()){
    $cantPaxGratis++;
}

Parse error: parse error in /Library/WebServer/Documents/versioned/software/tur/liquidacionHead.php on line 58

The if line is line 58. I've tried changing de || with OR but the same. If I change the second part (after || ) for a '1' or a '0' it works fine.

Extra information:

function isPasajeroSinCosto() {
     return ($this->tipo == 4);
}

PHP version:

PHP 7.1.0 (cli) (built: Dec 2 2016 03:30:24) ( NTS )

5
  • What is the output from $detalleReserva->isPasajeroSinCosto() ? Commented Feb 12, 2017 at 18:18
  • I've added the function @KhorneHoly Commented Feb 12, 2017 at 18:20
  • if you pasted all the relevant code, maybe just maybe we'd of pasted that in our (code) editors and would have seen that hidden (unicode) character, which I suspect is what it is. Because nothing in what you posted shows it. Commented Feb 12, 2017 at 18:40
  • I am not understanding the function isPasajeroSinCosto() because in this function what are you returning? ($this->tipo == 4) is a comparing situation. what will it return? Commented Feb 12, 2017 at 18:56
  • if the class variable tipo is equal to 4, then the function returns true, false otherwise Commented Feb 12, 2017 at 19:18

1 Answer 1

1

The problem was that I was using mac, and when pressing || and then space to quick (maybe pressing alt), an unknown character (invisible) get into the code and broke it.

Sign up to request clarification or add additional context in comments.

1 Comment

Yes, may I add that || and OR are exactly the same. (you stated that you tried changing that, in your question)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.