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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:23:52+00:00 2026-06-05T07:23:52+00:00

This thing is bugging me a lot. I’m getting Parse error: syntax error, unexpected

  • 0

This thing is bugging me a lot. I’m getting Parse error: syntax error, unexpected ‘.’, expecting ‘,’ or ‘;’ at this line

public static $user_table = TABLE_PREFIX . 'users';

TABLE_PREFIX is a constant created by define function

  • 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-05T07:23:53+00:00Added an answer on June 5, 2026 at 7:23 am

    Static class properties are initialized at compile time. You cannot use a constant TABLE_PREFIX to concatenate with a string literal when initializing a static class property, since the constant’s value is not known until runtime. Instead, initialize it in the constructor:

    public static $user_table;
    
    // Initialize it in the constructor 
    public function __construct() {
      self::$user_table = TABLE_PREFIX . 'users';
    }
    
    // If you only plan to use it in static context rather than instance context 
    // (won't call a constructor) initialize it in a static function instead 
    public static function init() {
      self::$user_table = TABLE_PREFIX . 'users';
    }
    

    https://www.php.net/manual/en/language.oop5.static.php

    Like any other PHP static variable, static properties may only be initialized using a literal or constant; expressions are not allowed. So while you may initialize a static property to an integer or array (for instance), you may not initialize it to another variable, to a function return value, or to an object.

    Update for PHP >= 5.6

    PHP 5.6 brought limited support for expressions:

    In PHP 5.6 and later, the same rules apply as const expressions: some limited expressions are possible, provided they can be evaluated at compile time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Usually I'm good with this type of thing, but this is bugging me. I
Why is this thing not working? [Database(Name=Relationships_Test)] [Table(Name = Order)] public class Order {
Why is this thing giving the message in the second line (i.e. list convertion)?
This thing has been bugging me for long and I can't find it anywhere!
This is one thing that has been bugging me for a while about DDD.
Usually this sort of thing I can do, but today it is bugging me.
I'm not new to this technology, but one thing is bugging me out. It's
I have this thing working mostly. What I don't get is, if I have
I have this thing that i need to do and some advices will be
I am confused with this thing, is emulator safe from pc network's firewall like

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.