[support] Issue picking a value from an array

Vaibhav Jain in.vaibhavjain at gmail.com
Sat Mar 24 01:28:46 UTC 2012


I see that there is an object within as object, with $email being your
object name, here it goes.
$email->5->field_email['und'][0]['value']; This should work for you.

On Sat, Mar 24, 2012 at 5:45 AM, Mutuku Ndeti <jnmutuku at gmail.com> wrote:

> Hi,
>
> I have picked an array from a custom node using entity_load.  I am
> trying to get the email value but it does not work.
>
> $email->field_email['und'][0]['value']; gives me nothing
>
> below is my print_r output
>
> stdClass Object ( [5] => stdClass Object ( [vid] => 5 [uid] => 1
> [title] => John Doe [log] => [status] => 1 [comment] => 0 [promote] =>
> 0 [sticky] => 0 [nid] => 5 [type] => supplier [language] => und
> [created] => 1332514672 [changed] => 1332514672 [tnid] => 0
> [translate] => 0 [revision_timestamp] => 1332514672 [revision_uid] =>
> 1 [body] => Array ( ) [field_email] => Array ( [und] => Array ( [0] =>
> Array ( [value] => John.Doe at jdoe.com [format] => [safe_value] =>
> John.Doe at jdoe.com ) ) ) [field_contact_name] => Array ( [und] => Array
> ( [0] => Array ( [value] => John Doe [format] => [safe_value] => John
> Doe ) ) ) [name] => admin [picture] => 0 [data] => b:0; ) )
>
> --
> Tel:254- 722-490994
> www.agile.co.ke | www.jipambe.com
> --
> [ Drupal support list | http://lists.drupal.org/ ]
>



-- 
Regards,
Vaibhav Jain
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20120324/a1687f7a/attachment.html 


More information about the support mailing list