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 8366733
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:59:20+00:00 2026-06-09T12:59:20+00:00

const SOME_PATH = __DIR__ . ‘/blabla.bla’; Doesn’t work I get a parse error: expecting

  • 0
const
   SOME_PATH = __DIR__ . '/blabla.bla';

Doesn’t work I get a parse error:

expecting ','' or‘;”

wtf!?

  • 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-06-09T12:59:21+00:00Added an answer on June 9, 2026 at 12:59 pm

    The problem isn’t the constant, it’s that you’re defining a class variable as a string using a non-literal.

    const SOME_PATH = __DIR__;
    

    Is fine, but once you start using concatenation, the parser throws a hissy fit.

    It’s the same reason why this works:

    class myClass {
        public $something = "something";
    }
    

    But this doesn’t:

    class myClass {
        public $something = "some" . "thing";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

class SomeClass: SOME_CONST = hello SOME_OTHER_CONST = SomeClass.SOME_CONST + world This doesn't work. NameError:
I'm inspecting some piece of code with valgrind and I get this error: ==7001==
Code: struct A{ const bool const_some_write_once_flag; A(): const_some_write_once_flag(false) { } }; struct B: public
I've run into some annoying issues with const-correctness in some templated code, that ultimately
I have some struct: struct A { const char* name_; A* left_; A* right_;
Can some body tell me the reason why we usually put const and &
I have some code that looks like: static const std::string and( AND ); This
I adh some constants in my project. private const int refercePosition = 0.3; I
It made some errors like this: KDnsCache.cpp: In member function ‘unsigned int KDnsCache::GetName(const char*)’:
according to some tutorials i read a while back, the const declaration makes a

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.