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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:39:03+00:00 2026-06-05T01:39:03+00:00

EDIT: I fixed my typos, and calling a class IS NOT case sensitive i’m

  • 0

EDIT:

I fixed my typos, and calling a class IS NOT case sensitive

i’m seeing that if I have

class A
{
    public function __construct()
    {
        echo 'hello';
    }
}

and do this

if (class_exists('a'))
    $class = 'a';

$a = new $class();

I will see

hellohello

If i comment out the if statement then I’m okay, it will echo out

hello

How can I stop the class_exists() from running the classes constructor?

EDIT:

this is my usage

foreach ($this->getNamespace() as $ns) {

                    //if (class_exists($ns . '\\' . $controller))
                        $controller = $ns . '\\' . $controller;

                    if (class_exists($ns . '\\' . $model))
                        $model = $ns . '\\' . $model;
                }

                $model = new $model($this->config);
                $controller = new $controller($this->config);
  • 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-05T01:39:05+00:00Added an answer on June 5, 2026 at 1:39 am

    When running the following code:

    class A
    {
        public function __construct()
        {
            echo 'hello';
        }
    }
    
    if (class_exists('a'))
        $class = 'a';
    
    $a = new $class();
    

    I get:

    hello
    

    Your problem is likely elsewhere.

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

Sidebar

Related Questions

EDIT: I have fixed all but two warnings now, so thank you all for
Edit : The bug that caused this problem has been fixed. The @version tag
EDIT FIXED by user @jeroen You have to move the li and a tags
* edit have fixed this code - see inline comments marked EDIT * I'm
Fixed: See notes at bottom I am implementing a generic class that supports two
EDIT: Fixed most of the problem (but not too sure why). Check the bottom
Edit: I fixed the problem by just starting from scratch. Sorry to waste y'alls
Edit: closing anchor fixed. This issue exists when testing on the following browsers: Google
EDIT : As of 2012-06-11 this bug has been finally fixed! https://bugs.webkit.org/show_bug.cgi?id=35981#c1 I have
I have the following code: <Window x:Class=UnderstandSizing.Window2 xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml Title=Window2 Height=300 Width=300> <Grid> <Grid.ColumnDefinitions>

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.