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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:45:53+00:00 2026-05-13T17:45:53+00:00

class a { function __get($property){…} } $obj = new a(); var_dump(isset($obj->newproperty)); Seems the answer

  • 0
class a {
   function __get($property){...}
}

$obj = new a();
var_dump(isset($obj->newproperty));

Seems the answer is nope but why?

  • 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-13T17:45:54+00:00Added an answer on May 13, 2026 at 5:45 pm

    Because it checks __isset rather than retrieving it using __get.

    It is a much better option to call __isset, as there is no standard on what is empty. Maybe in the context of the class null is an acceptable value. You could also have a class that if the member didn’t exist, it returned a new empty object, which would break isset($myObj->item) as in that case it would always return true.

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

Sidebar

Related Questions

<?php abstract class AbstractClass { public function __get($theName) { return (isset($this->$theName)) ? $this->$theName :
I am trying to add eventlistener and use it in a class function but
I'm attempting to use Map to reference a class function, but am having difficulty
I created a new model class as my_model.php inside /models folder, and a function
Having the following code class test { private $name; public function __get($name){ return $name;
I've made a class: class MyClass { function __get($name) { $this->{$name} = $_SESSION[$name]; }
Expressions like these: $var function() $object->getProperty($var); $object->property $object->property->function($var) class::function() etc. I want to get
How do i get all defined global variables inside a class function? When I
This is my query: class services extends Zend_Db_Table{ function Get_Services($user_id){ $DB = Zend_Db_Table_Abstract::getDefaultAdapter(); $select
Function abstraction: public abstract class Function<X, Y> { abstract Y apply(X x); } max

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.