Menu

#1120 PHPParser: Doesn`t support PHP 5.3 elvis operator

closed-fixed
None
5
2010-01-18
2008-12-23
No

$httpHost = !empty($httpHost) ?: $_SERVER['HTTP_HOST'];

Discussion

  • Matthieu Casanova

    Hi, are you sure this syntax is valid ? It seems it miss something between the ? and :

     
  • Vadim Voituk

    Vadim Voituk - 2010-01-08

    Hmm.. Really bad example.
    The better one is:

    $x = $a ?: $b; //elvis (coalesce, short ternary, etc) operator available since PHP 5.3

    is equivalent to

    $x = $a ? $a : $b;

    But in first case i`m getting the syntax error from PHParser plugin.

     
  • Matthieu Casanova

    fixed in trunk

     
  • Matthieu Casanova

    • status: open --> closed-fixed
     

Log in to post a comment.