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 )

Nytrix
  • 1,139
  • 11
  • 23
user1532587
  • 993
  • 1
  • 14
  • 39
  • What is the output from `$detalleReserva->isPasajeroSinCosto()` ? – KhorneHoly Feb 12 '17 at 18:18
  • I've added the function @KhorneHoly – user1532587 Feb 12 '17 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. – Funk Forty Niner Feb 12 '17 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? – Prateek Verma Feb 12 '17 at 18:56
  • if the class variable tipo is equal to 4, then the function returns true, false otherwise – user1532587 Feb 12 '17 at 19:18

1 Answers1

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.

user1532587
  • 993
  • 1
  • 14
  • 39
  • 2
    Yes, may I add that `||` and `OR` are *exactly* the **same**. (you stated that you tried changing that, in your question) – Nytrix Feb 12 '17 at 18:26