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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T06:56:12+00:00 2026-06-04T06:56:12+00:00

So I have a PHP stack that looks roughly like this Class Stack {

  • 0

So I have a PHP stack that looks roughly like this

Class Stack {

    public $name;
    public $parent;
    public $children = array();

    public function __construct($name, $parent = false) {
        $this->name = $name;
        $this->parent = $parent;
    }

    public function newChild($name) {
        $this->children[] = new Stack($name, $this);
    }

    public function &top() {
        if(is_object($this->parent))
            return $this->parent->top();
        return $this;
    }

}

So somewhere around level 5 of this stack I want to access level 0 using the top() method because i need to make a modification to it. So I do but the modification i make doesnt apply in the final build sequence because it wasent passed by reference. I have tried a couple different ideas but I still am not able to get it to pass thru right. Any ideas?

EDIT: I actually figured it out. What I wrote above actually works perfectly the stack I was working with kinda got huge and somewhere along the way the parent wasent set, so it wasn’t going up the stack all the way. To see what project this actually is. take a peek at http://github.com/EvolutionSDK/lhtml (Logical HTML… gives limited access to PHP from an HTML based page. Basically both the C and V in MVC architecture frameworks.)

  • 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-04T06:56:12+00:00Added an answer on June 4, 2026 at 6:56 am

    Basically in my large PHP Stack I had a unset “parent” variable. Which kept the top() function from accessing the top of the stack. So it only went part way up.

    When I figured that out and reconnected the child to its parent and it worked perfectly. As classes are always passed by reference.

    Sorry for how long it took me to post this.

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

Sidebar

Related Questions

I have a function that looks like this class NSNode { function insertAfter(NSNode $node)
I have PHP scrip that goes like this: if ($cost_frm < $cost){ echo <script
I have quite a few RewriteRules in my .htaccess that looks like this RewriteRule
Im trying to create something that looks like this using php gd library: I've
I have php scripts that do things like register, login, upload. I would like
I have a problem: I have a textarea on my page that looks like
I'm using php,html,javascript,mysql. My functionality goes like this. I have a division made in
I have an Ajax function which looks like : function getData(p) { loadingImage(); p
I have a PHP/MySQL query that returns to an HTML table, and I'm stuck
I have php array ($_FILE[fails]) I need to output only thous names where type

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.