So I have an object $entity, and a property $property.
$property has several arrays inside of it.
I want to be able to unset these arrays, as such:
unset($entity->$property['array']);
However, I'm getting the error:
Error: Cannot use string offset as an array
I tried setting $entity->$property to a single variable, but $entity was passed by reference into the function, and changing a new variable isn't going to modify the old object.
How do I ensure the old object gets modified and these arrays get unset?
Here is part of the entity, up until the property:
stdClass Object
(
    [vid] => 33128
    [uid] => 3
    [title] => Title
    [log] => 
    [status] => 0
    [comment] => 0
    [promote] => 1
    [sticky] => 0
    [vuuid] => 3f922255-462b-459a-a8d6-9a2ac30899cf
    [hash] => fa14fb00f1355761429977fe916e8f66
    [nid] => 29652
    [type] => resource
    [language] => en-US
    [created] => 1137158100
    [changed] => 1371649725
    [tnid] => 29652
    [translate] => 0
    [uuid] => 051eba0c-4b52-4269-b0d2-4d0ced9d6a6e
    [revision_timestamp] => 1371649725
    [revision_uid] => 0
    [body] => Array
        (
        )
    [field_file] => Array
        (
            [und] => Array
                (
                    [0] => Array
                        (
                            [fid] => 26750
                            [uid] => 1
                            [filename] => filename.pdf
                            [uri] => public://cms/cms/filepath/filename.pdf
                            [filemime] => application/pdf
                            [filesize] => 666960
                            [status] => 1
                            [timestamp] => 1370660770
                            [type] => default
                            [uuid] => ea7c2c1f-4ef2-44fb-b89d-51c0fa090793
                            [hash] => aafc3f362cda639dc0475fccbeeb9af2
                            [rdf_mapping] => Array
                                (
                                )
                            [display] => 1
                            [description] => filename.pdf
                        )
                )
        )
$property is field_file, and looks like this:
Array ( [und] => Array ( [0] => Array ( [fid] => 11285 [uid] => 1 [filename] => filename.pdf [uri] => public://cms/cms/resource_library/datasheets/filepath/filename.pdf [filemime] => application/pdf [filesize] => 666960 [status] => 1 [timestamp] => 1368086259 [type] => default [uuid] => ea7c2c1f-4ef2-44fb-b89d-51c0fa090793 [hash] => cdb2fc5203a9e7f9c066a89bf9f70502 [rdf_mapping] => Array ( ) [display] => 1 [description] => filename.pdf ) ) )
$entity->$property['array']expression, array access is processed first. So it technically reads as$entity->($property['array']).