Welcome Guest, Not a member yet? Register   Sign In
What is the meaning of std Class object ... + array
#4

[eluser]Sire[/eluser]
A common issue I've seen is the reverse of CroNIX's comment, "Creating default object from empty value"

An example where I've seen this is in the WordPress includes, user.php. An example:
Code:
$blog_id = get_current_blog_id();
        $blogs = array();
        $blogs[ $blog_id ]->userblog_id = $blog_id;

The solution is to create the default object first
Code:
$blog_id = get_current_blog_id();
        $blogs = array();
        $blogs[ $blog_id ] = new stdClass();  // this was added
        $blogs[ $blog_id ]->userblog_id = $blog_id;


Messages In This Thread
What is the meaning of std Class object ... + array - by El Forum - 04-28-2011, 05:04 AM
What is the meaning of std Class object ... + array - by El Forum - 04-28-2011, 08:35 AM
What is the meaning of std Class object ... + array - by El Forum - 04-28-2011, 03:05 PM
What is the meaning of std Class object ... + array - by El Forum - 04-29-2011, 05:42 AM



Theme © iAndrew 2016 - Forum software by © MyBB