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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:56:10+00:00 2026-06-10T20:56:10+00:00

In this example I get the fatal error Fatal error: Using $this when not

  • 0

In this example I get the fatal error “Fatal error: Using $this when not in object context” as expected

class ctis_parent{
    public function objFunc(){
        var_dump('Called succes');
    }

    public static function call(){

        $this->objFunc(); 
    }

    public function __construct(){
        self::call();
    }

}

new ctis_parent();

But if remove static keyword from definition of call() method all work fine, why?

class ctis_parent{
    public function objFunc(){
        var_dump('Called succes');
    }

    public  function call(){
        $this->objFunc();
    }

    public function __construct(){
        self::call();
    }

}

new ctis_parent(); 

//string 'Called succes' (length=13)
  • 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-10T20:56:11+00:00Added an answer on June 10, 2026 at 8:56 pm

    Because you’re using $this when you’re not in an object. Well, you’re not REALLY, but with the static declaration, people could do:

    ctis_parent::call();
    

    Where, $this would be illegal.

    See the docs for static.

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

Sidebar

Related Questions

Why am I getting this error? Warning: file_get_contents(http://www.example.com) [function.file-get-contents]: failed to open stream: HTTP
When running my SSIS using LDAP, I get this error on my ADO Datasource:
I am following this example to get JSONP data from remote server. jQuery append
hello i am make like this example which i get from www.xxxxxx.com http://s1172.photobucket.com/albums/r568/novikoraharja/?action=view&current=justanimage.png i
In this example, <%=button_to_remote Get Related Users, {:url => { :action => 'get_related_users' },
I have this simple example I can't seems to get working : MERGE INTO
How do you get to the next node below this For example <ul id=secondary-nav>
How i can get full right name of generic type? For example: This code
I'm having troubles setting the background color for JButtons. For example I get this
I want to get 100 and example from this string ?connect:100/username:example/ I searched in

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.