Why does a PHP function with no parameters require parentheses?

Posted by MarkRobinson on Stack Overflow See other posts from Stack Overflow or by MarkRobinson
Published on 2010-05-14T10:46:13Z Indexed on 2010/05/14 10:54 UTC
Read the original article Hit count: 272

Filed under:
|
|

I just spent 3 hours wondering why I couldn't start a session, then realised that I used:

session_start;

when I should have used:

session_start();

I received no error messages at all!

Perhaps then, I thought, it's a lazy way to differentiate functions from variables - but then remembered that it can't be as variables require a $

Can anyone tell me why parentheses are required then, and also why no error is given when they aren't used?

© Stack Overflow or respective owner

Related posts about php

Related posts about parentheses