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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T02:08:36+00:00 2026-06-08T02:08:36+00:00

Testing some late static binding and getting this error on line 5: Parse error:

  • 0

Testing some late static binding and getting this error on line 5:

Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE

line 5:

protected static test = 'A TEST';

Here is the source:

class A {

    protected static test = 'A TEST';

    public static function test() {
        echo $this->test;
    }
}

Class B extends A {
    public static test = "B TEST";
    public function static_test() {
        echo static::$test;
    }
}

$a = new A;
$b = new B;

echo '$a->test()<br />';
echo $a->test();
echo '<br /> <br />';
echo '$b->test()<br />';
echo $b->test();
echo '<br /> <br />';
echo '$b->static_test()<br />';
echo $b->static_test();

Safe to say I am stumped.

  • 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-08T02:08:37+00:00Added an answer on June 8, 2026 at 2:08 am
    protected static $test = 'A TEST';
                     ^--- !!!
    

    It’s not a constant – so it should be preceded by $ sign

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

Sidebar

Related Questions

Hi I'm testing some CRUD operations in Nhibernate. I have 3 tests in this
I'm testing some legacy code that extends the default php exception object. This code
I am now testing some IPN for our subscription system. from this document https://www.paypal.com/cgi-bin/webscr?cmd=p/acc/ipn-subscriptions-outside
I've got this issue with database locking when I'm testing some threading features I've
I've been testing some stuff with Google maps, and while this code gives me
I am in the process of testing some error handling code and am trying
I'm testing some python code that parses command line input. Is there a way
I'm testing some snippets I found off the web using g++ from MinGW. This
I am testing some small scripts that I have. This particular one is driving
I'm testing some methods that involve email, and am trying to use a mock

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.