hi I working with Drupal and it uses arrays to a level I’m not very familier with, I’ve a quick question which is what is the difference between these ‘selectors'(is that the right term)?
This causes an error “Fatal error: Cannot use object of type stdClass as array in…”
$node['field_geoloc']
this works (im using it in an if != null statement)
$node->field_geoloc
hopefully an easy question…
thanks.
Pretty easy.. the error says it all:
You are attempting to use an object as an array.
Object properties aren’t accessibly using the
$array['key']method that you are used to. You need to access properties like:If you have an object, you can get the properties from that array by using the get_object_vars method. But I know from experience that you should not use that method with a $node in Drupal.