Can\'t figure what is wrong here. Read what folks are saying here: http://informationideas.com/news/2006/06/14/fatal-error-cannot-use-string-offset-as-an-array-in/ and her
My bet is that either
$e
are not arraystry
foreach ( $entries as $e ) {
$info = array(); // added to see if pre-declaration helps
if (is_array($e)) // only go on if $e is actually an array
$info = array( $e[ 'title' ],
$e[ 'gd:when attr' ][ 'startTime' ],
$e[ 'gd:where attr' ][ 'valueString' ],
$e[ 'content' ] );
}
If you want to do it really properly, you check for each key of $e
("startTime" and so on) first using isset()
or array_key_exists()
.
you dont need the foreach
$info = array(
$entries[ 'title' ],
$entries[ 'gd:when attr' ][ 'startTime' ],
$entries[ 'gd:where attr' ][ 'valueString' ],
$entries[ 'content' ]
);
To overcome this error at first check whether its an array or net then do array elements manipulat