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

  • Home
  • SEARCH
  • 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 8864679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:18:16+00:00 2026-06-14T16:18:16+00:00

This message shows in php 5.4 for some weird reason. My class looks like

  • 0

This message shows in php 5.4 for some weird reason.

My class looks like this:

abstract class model{

  private static
    $tableStruct = array();

  abstract protected static function tableStruct();

  public static function foo(){
    if(!isset(self::$tableStruct[get_called_class()]))
      self::$tableStruct[get_called_class()] = static::tableStruct();

    // I'm using it here!!
  }

}

and should be used like:

class page extends model{

  protected static function tableStruct(){
    return array(
      'id' => ...
      'title' => ...
    );
  }

  ...

}

Why making a static method required by child classes is considered to be against the standards?

  • 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-14T16:18:17+00:00Added an answer on June 14, 2026 at 4:18 pm

    Abstract static methods are kind of an odd concept. A static method basically “hard codes” the method to the class, making sure there is only a single instance (~singleton). But making it abstract means you want to force some other class to implement it.

    I see what you are trying to do, but when dealing with abstract classes, I would avoid static methods in the base class. What you can do instead is use late static binding (static::) to call a tableStruct method in the “child” class. This doesn’t force the the method to be implemented like abstract does, but you could test for the implementation and throw an exception if it doesn’t exist.

    public static function foo(){
        // call the method in the child class 
        $x = static::tableStruct();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After a while using the website, loading contents, etc.. this message shows Fill: SelectCommand.Connection
How do I better debug this message? The trace shows 3 lines from one
See this question. How to show popup message like in stackoverflow I am trying
I have this function that puts some data with Ajax call in a php
For some reason my php mail() function does not send html, Instead of <a
Been using PHP for quite some time now and I was wondering what this
I'm developing a website in php. I want to show a message something like
I have below query I am trying to show message 'No SubSource for this
<div style=background-color:black> <div style=float:right> Test message </div> <div> This will show 'Test message' with
Why does Glassfish shows this facelets error: javax.el.ELException: /foo/client.xhtml @11,74 value=#{messageBean.messages}: javax.mail.MessagingException: Socket closed;

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.