Skip to content

Extract into object scope #508

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed

Extract into object scope #508

wants to merge 5 commits into from

Conversation

krakjoe
Copy link
Member

@krakjoe krakjoe commented Oct 28, 2013

https://bugs.php.net/bug.php?id=26545

I'm not sure how we should handle missing handlers for objects, or if that can reasonably occur even ...

--FILE--
<?php
class test {
    public $hello = "exists";

    public function __construct(&$server) {
        extract($server, EXTR_OBJECT|EXTR_PREFIX_SAME, "testing", $this);
    }
}

$array = array(
    "hello" => "world"
);

var_dump(new test($array));
?>
--EXPECTF--
object(test)#%d (%d) {
  ["hello"]=>
  string(6) "exists"
  ["testing_hello"]=>
  string(5) "world"
}

Being that there is an added parameter, EXTR_OBJECT may not be actually necessary ? Its nice to be precise tho ...

@krakjoe krakjoe closed this Nov 2, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant