Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 788781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:25:18+00:00 2026-05-14T21:25:18+00:00

I just spent 3 hours wondering why I couldn’t start a session, then realised

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T21:25:19+00:00Added an answer on May 14, 2026 at 9:25 pm

    I get the notice (Having set error_reporting to E_ALL):

    Notice: Use of undefined constant session_start – assumed ‘session_start’ in /t.php on line 5

    A function always needs the parentheses as else (as you can see) you can’t tell the difference between a function and a constant. As code should be written so it can be understood by the human reading it, not allowing the reader to see if it is a constant or function call makes it that bit harder to read and debug.

    I assume it is a notice rather than an error error due to backwards compatibility in that some older code tends to access arrays using unquoted strings which PHP would treat as quoted strings if there wasn’t a constant with that name.

    $myArray[myString] = 25;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I spent hours trying to fix that but I've just given up; I have
I have a large music library which I have just spent around 30 hours
I have just spent a couple of hours trying to represent the decision tree
I just spent 5 hours by checking Google gadgets websites and FAQs, but I
Just spent several hours writing up for a new site... looks great in my
Is there another way to do this? Just spent 2 hours trying to figure
I just spent a few hours pulling my hair out over this. I'm trying
New to rails, and I've just spent hours trying to hunt down a bug.
I've just spent about 2 hours trying to get this to work. I've never
I just spent hours trying to debug my code. The whole problem boiled down

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.