WordPress.org

Ready to get started?Download WordPress

Forums

Why assign by reference ? (2 posts)

  1. mp2300
    Member
    Posted 4 years ago #

    Many of the WP_* global objects are created in wp-setings.php with assign by reference:
    $wp_widget_factory =& new WP_Widget_Factory();

    What are the benefits of this approach. It breaks some of my scripts, and makes it impossible to load the WordPress enviroment from external PHP files.

  2. esmi
    Forum Moderator
    Posted 4 years ago #

    Doesn't passing by reference allow you to access the same variable content by different names? I'd imagine that allows for far more "re-usable" code blocks.

    http://uk2.php.net/manual/en/language.references.whatdo.php

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.