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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:26:52+00:00 2026-06-14T15:26:52+00:00

Basically I am using Code Igniter, and the Code Igniter base class is huge,

  • 0

Basically I am using Code Igniter, and the Code Igniter base class is huge, when I print_r some of my objects they have the base class embedded inside them. this makes it a pain to get the information I actually wanted (the rest of the properties).

So, I am wondering if there is a way I can hide, or remove the base class object?

I have tried

clone $object;
unset($object->ci);
print_r($object);

but of course the ci property is private.

the actual function I am using for dumping is:

/**
 * Outputs the given variables with formatting and location. Huge props
 * out to Phil Sturgeon for this one (http://philsturgeon.co.uk/blog/2010/09/power-dump-php-applications).
 * To use, pass in any number of variables as arguments.
 * Optional pass in "true" as final argument to kill script after dump
 *
 * @return void
 */
function dump() {
    list($callee) = debug_backtrace();
    $arguments = func_get_args();
    $total_arguments = count($arguments);
    if (end($arguments) === true)
        $total_arguments--;

    echo '<fieldset style="background: #fefefe !important; border:2px red solid; padding:5px">';
    echo '<legend style="background:lightgrey; padding:5px;">' . $callee['file'] . ' @ line: ' . $callee['line'] . '</legend><pre>';

    $i = 0;
    foreach ($arguments as $argument) {
        //if the last argument is true we don't want to display it.
        if ($i == ($total_arguments) && $argument === true)
            break;

        echo '<br/><strong>Debug #' . (++$i) . ' of ' . $total_arguments . '</strong>: ';

        if ((is_array($argument) || is_object($argument)) && count($argument)) {
            print_r($argument);
        } else {
            var_dump($argument);
        }
    }

    echo '</pre>' . PHP_EOL;
    echo '</fieldset>' . PHP_EOL;

    //if the very last argument is "true" then die
    if (end($arguments) === true)
        die('Killing Script');
}
  • 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-14T15:26:53+00:00Added an answer on June 14, 2026 at 3:26 pm

    This should work for returning only public vars for unknown class:

    // Get the class of the object
    $class_of_object= get_class($object);
    
    // Get only public attributes (Note: if called from within class will return also private and protected)
    $clone = get_class_vars($class_of_object);
    
    // Try it
    dump($clone);
    

    And this is quite hacky, but works – to remove private property from object ( This will not preserve object name ) and of course another drawback is that you need to hard code property name:

    // First cast clone to array
    $b = (array) clone($a);
    
    // Then unset value (There will be null bytes around A and to use them you need to run it in double quotes
    // Replace A for * to remove protected properties
    unset($b["\0A\0_ci"]);
    
    // Finally back to object
    $b = (object) $b;
    
    // Test it
    dump($b);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I speed up a recursive code using OpenMP? Basically, I have to
Basically I am using some open source code called OrderedDictionary that is derived from
I'm using the JQuery DropdownChecklist as available from here: http://code.google.com/p/dropdown-check-list/ Basically I'm using some
I am using Code Igniter and I am implementing a remember user functionality. Basically,
Im currently using Code Igniter to have pretty URLs, and I have this system
I am using Code::Blocks 10.05, and the GNU GCC Compiler. Basically, I ran into
I am using the code below, its basically babylonian method, how can i modify
I am using this code to alter the title of an image. Basically it
I'm using this plugin and here is the code: http://jsfiddle.net/gm8t5/ Basically I want to
I am using the Cart class of CodeIgniter, basically that's just sessions. Now, Safari

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.