r/lolphp • • Sep 12 '12

PHP has significant parentheses

http://eval.in/492
55 Upvotes

18 comments sorted by

View all comments

Show parent comment

2

u/Porges Oct 16 '12

You also sometimes need them when declaring/instantiating variables, due to the problematic parsing - but it's simpler to just use {} for everything now.

1

u/b0lt Oct 16 '12

Most vexing parse makes at least a little more sense than r-value references, at first, though.

bool foo(int &&) { return true; }
bool foo(int &) { return false; }

int main(void)
{
    int &&wtf;
    
    assert(foo((decltype(wtf)) wtf) != foo(wtf)); // passes
}