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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:00:40+00:00 2026-05-26T08:00:40+00:00

I’ve been working lately on a custom framework, so before posting my concern I

  • 0

I’ve been working lately on a custom framework, so before posting my concern I will explain the way I organized the framework.

There is a main class, from which all other classes are extended. All the other classes are interconnected between them with a a variable which has the name of the class. Easier said, I have the MAIN class. I also have the classes THEME, URI, INIT.

After the framework has initialized, if I get the MAIN instance and assign it to a variable, lets say $main, and I can use the other classes like this:

$main->theme;
$main->uri;
$main->init;

I can even use $main->theme->uri->theme->init if I want :D, but no way $main->theme->theme.

Also, from inside the classes (other than MAIN), I can access the other classes like $this->init, $this->theme, etc.
The properties that point to those classes are references.

Now my concern, when I print_r the $main variable, I get a lot of RECURSION elements. The framework loads fast, and the memory consumption is 28MB, but still I get that recursion. Does it mean that the way I organized my framework is wrong, or it’s just the print_r function that sees pointers pointing to same classes, and avoids infinite recursion?

Ok, here’s a print_r of the TF_TFUSE class (the main one i was talking about). Here only two other classes have been implemented (too reduce output).

TF_TFUSE Object
(
    [framework_version] => 2.1
    [load] => TF_LOAD Object
        (
            [_the_class_name] => LOAD
            [framework_version] => 2.1
            [buffer] => TF_BUFFER Object
                (
                    [_filters:protected] => Array
                        (
                        )

                    [_buffer:protected] => 
                    [_the_class_name] => BUFFER
                    [_is_end:protected] => 
                    [framework_version] => 2.1
                    [load] => TF_LOAD Object
 *RECURSION*
                )

        )

    [buffer] => TF_BUFFER Object
        (
            [_filters:protected] => Array
                (
                )

            [_buffer:protected] => 
            [_the_class_name] => BUFFER
            [_is_end:protected] => 
            [framework_version] => 2.1
            [load] => TF_LOAD Object
                (
                    [_the_class_name] => LOAD
                    [framework_version] => 2.1
                    [buffer] => TF_BUFFER Object
 *RECURSION*
                )

        )

)
  • 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-05-26T08:00:40+00:00Added an answer on May 26, 2026 at 8:00 am

    The problem is that you are linking everything together inside your objects. This problem is normally solved by creating a container class that holds the other objects and creates interactions between them.

    To be able to do $main->theme->uri->theme->uri->theme->uri->theme->uri->theme->uri->theme->uri->theme->uri->theme->uri->theme->uri->theme->uri->theme->init should give you an indication that something is wrong . . .

    A possible solution is represented generically below:

    class Manager {
        $theme;
        $uri;
        $init;
    }
    

    And THEME, URI, and INIT no longer have direct relationships to each other.

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

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small

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.