I have a multidimensional object called $videos which contains a number of video objects.
I cast my $videos object to an array as follows
$videos = (array)$videos
When I var_dump($videos) it returns all of the data from $videos as shown below ($videos now being a multidimensional array)
array(47) {
["query"] => array(3) {
["post_type"] => string(8) "bf_video"
["posts_per_page"] => int(10)
["paged"] => int(1)
}
["query_vars"] => array(61) {
["post_type"] => string(8) "bf_video"
["posts_per_page"] => int(10)
["paged"] => int(1)
["error"] => string(0) ""
["m"] => string(0) ""
["p"] => int(0)
["post_parent"] => string(0) ""
["subpost"] => string(0) ""
["subpost_id"] => string(0) ""
["attachment"] => string(0) ""
["attachment_id"] => int(0)
["name"] => string(0) ""
["static"] => string(0) ""
["pagename"] => string(0) ""
["page_id"] => int(0)
["second"] => string(0) ""
["minute"] => string(0) ""
["hour"] => string(0) ""
["day"] => int(0)
["monthnum"] => int(0)
["year"] => int(0)
["w"] => int(0)
["category_name"] => string(0) ""
["tag"] => string(0) ""
["cat"] => string(0) ""
["tag_id"] => string(0) ""
["author"] => string(0) ""
["author_name"] => string(0) ""
["feed"] => string(0) ""
["tb"] => string(0) ""
["comments_popup"] => string(0) ""
["meta_key"] => string(0) ""
["meta_value"] => string(0) ""
["preview"] => string(0) ""
["s"] => string(0) ""
["sentence"] => string(0) ""
["fields"] => string(0) ""
["menu_order"] => string(0) ""
["category__in"] => array(0) {}
["category__not_in"] => array(0) {}
["category__and"] => array(0) {}
["post__in"] => array(0) {}
["post__not_in"] => array(0) {}
["tag__in"] => array(0) {}
["tag__not_in"] => array(0) {}
["tag__and"] => array(0) {}
["tag_slug__in"] => array(0) {}
["tag_slug__and"] => array(0) {}
["post_parent__in"] => array(0) {}
["post_parent__not_in"] => array(0) {}
["author__in"] => array(0) {}
["author__not_in"] => array(0) {}
["ignore_sticky_posts"] => bool(false)
["suppress_filters"] => bool(false)
["cache_results"] => bool(true)
["update_post_term_cache"] => bool(true)
["update_post_meta_cache"] => bool(true)
["nopaging"] => bool(false)
["comments_per_page"] => string(2) "50"
["no_found_rows"] => bool(false)
["order"] => string(4) "DESC"
}
["tax_query"] => object(WP_Tax_Query)#859 (6) {
["queries"] => array(0) {}
["relation"] => string(3) "AND"
["table_aliases":protected] => array(0) {}
["queried_terms"] => array (0) {}
["primary_table"] => string(10) "live_posts"
["primary_id_column"] => string(2) "ID"
}
["meta_query"] => object(WP_Meta_Query)#858 (7) {
["queries"] => array (0) {}
["relation"] => NULL
["meta_table"] => NULL
["meta_id_column"] => NULL
["primary_table"] => NULL
["primary_id_column"] => NULL
["table_aliases":protected] => array (0) {}
}
["date_query"] => bool(false)
["request"] => string(234) "SELECT SQL_CALC_FOUND_ROWS live_posts.ID FROM live_posts WHERE 1=1 AND live_posts.post_type = 'bf_video' AND (live_posts.post_status = 'publish' OR live_posts.post_status = 'private') ORDER BY live_posts.post_date DESC LIMIT 0, 10"
["posts"] => array(10) {
[0] => object(WP_Post)#851(24) {
["ID"] => int(505)
["post_author"] => string(1) "3"
["post_date"] => string(19) "2015-03-10 13:27:30"
["post_date_gmt"] => string(19) "2015-03-10 17:27:30"
["post_content"] => string(116) "carp on the fly in NY's croton watershed http://www.onehookup.blogspot.com http://www.jajphotography.wordpress.com"
["post_title"] => string(41) "Carp on the fly: Landing in a pot of gold"
["post_excerpt"] => string(0) ""
["post_status"] => string(7) "publish"
However if I try to var_dump any particular element of this array as shown below it returns null...
var_dump($videos[0]);
var_dump($videos[1]);
var_dump($videos[2]);
So why is var_dump() returning null when called with each individual element of the array??? Is it something to do with the visibility of the objects properties?