PDA

View Full Version : PHP Array question / help


edge
6th January 2009, 23:10
I have an array named 'From'.
When I do a var_dump like this:
var_dump($results['From']);

It will show me this:
array(1) { [0]=> array(2) { ["address"]=> string(11) "my@emailaddress.com" ["name"]=> string(4) "Edge" } }

Now how do I put my@emailaddress.com in a sting named $my_email ?
I've tried $my_email = $results['From[11]'] , but with no luck.

Anyone here who can help?

Ben
7th January 2009, 08:26
though tooo far above the edge ;)

It's a 2 dimensional array (seen from the element "From"), the second is with named keys...


$my_email = $result['From'][0]['address'];


Just a question, where does this structure is build from as it looks pretty complicated for such usage. Especially I do not understand for what the 1st dimension in "from" is needed, as an email normally has only one sender ;)

edge
7th January 2009, 23:37
Thank you Ben.
Your input helped (and worked) :-)

re: Just a question, where does this structure is build from as it looks pretty complicated for such usage

It's part of a PHP MIME decoding function that I'm trying to use for one of my projects.

Ben
8th January 2009, 08:29
Ah I see, I guess you mean this pear Class?

edge
8th January 2009, 10:46
Ah I see, I guess you mean this pear Class?

yes thats what it is.

Stenna
4th February 2009, 07:06
you can solve this problem with the help of w3schools.com.you can use this site for solve out your problem .:)

channerhewitt
4th February 2009, 07:53
you can solve this problem with the help of w3schools.com.you can use this site for solve out your problem .:)

yeah right, I used to learn PHP on site too. :)