Extract something from array
I have thsi result if I vardump an array.
`object(stdClass)#284 (39) { ["nid"]=> string(3) "516" ["type"]=> string(10) "classified" ["language"]=> string(2) "de" ["uid"]=> string(4) "5074" ["status"]=> string(1) "1" ["created"]=> string(10) "1284678918" ["changed"]=> string(10) "1284678918" ["comment"]=> string(1) "0" ["promote"]=> string(1) "0" ["moderate"]=> string(1) "0" ["sticky"]=> string(1) "0" ["tnid"]=> string(1) "0" ["translate"]=> string(1) "0" ["vid"]=> string(3) "522" ["revision_uid"]=> string(4) "5074" ["title"]=> string(5) "Stuhl" ["body"]=> string(62) "
mmmm
" ["teaser"]=> string(62) "
mmmm
" ["log"]=> string(0) "" ["revision_timestamp"]=> string(10) "1284678918" ["format"]=> string(1) "3" ["name"]=> string(14) "lars schilling" ["picture"]=> string(0) "" ["data"]=> string(69) "a:3:{s:7:"contact";i:1;s:7:"invites";i:99982;s:11:"invite_sent";b:1;}" ["sections"]=> array(1) { ["theme"]=> bool(false) } ["path"]=> string(5) "stuhl" ["field_classified_email"]=> array(1) { [0]=> array(1) { ["value"]=> string(13) "info@3cees.de" } } ["field_classified_phone"]=> array(1) { [0]=> array(1) { ["value"]=> NULL } } ["field_classified_valid_till"]=> array(1) { [0]=> array(4) { ["value"]=> string(19) "2010-10-17T00:00:00" ["timezone"]=> string(13) "Europe/Berlin" ["timezone_db"]=> string(13) "Europe/Berlin" ["date_type"]=> string(4) "date" } } ["field_classified_image"]=> array(1) { [0]=> array(10) { ["fid"]=> string(3) "317" ["list"]=> str开发者_运维技巧ing(1) "1" ["data"]=> array(2) { ["alt"]=> string(0) "" ["title"]=> string(0) "" } ["uid"]=> string(4) "5074" ["filename"]=> string(9) "stuhl.jpg" ["filepath"]=> string(29) "files/kleinanzeigen/stuhl.jpg" ["filemime"]=> string(10) "image/jpeg" ["filesize"]=> string(5) "52586" ["status"]=> string(1) "1" ["timestamp"]=> string(10) "1284678898" } } ["field_expired_mail_send"]=> array(1) { [0]=> array(1) { ["value"]=> string(1) "0" } } ["print_display"]=> int(1) ["print_display_comment"]=> int(0) ["print_display_urllist"]=> int(1) ["last_comment_timestamp"]=> string(10) "1284678918" ["last_comment_name"]=> NULL ["comment_count"]=> string(1) "0" ["taxonomy"]=> array(0) { } ["nodewords"]=> array(13) { ["abstract"]=> array(1) { ["value"]=> string(0) "" } ["canonical"]=> array(1) { ["value"]=> string(0) "" } ["copyright"]=> array(1) { ["value"]=> string(64) "." } ["dc.contributor"]=> array(1) { ["value"]=> string(0) "" } ["dc.creator"]=> array(1) { ["value"]=> string(0) "" } ["dc.date"]=> array(1) { ["value"]=> array(3) { ["day"]=> string(2) "17" ["month"]=> string(1) "9" ["year"]=> string(4) "2010" } } ["dc.title"]=> array(1) { ["value"]=> string(0) "" } ["description"]=> array(1) { ["value"]=> string(0) "" } ["keywords"]=> array(1) { ["value"]=> string(271) "Antihomotoxische Arzneimittel, Antihomotoxische Therapie, Gesundheit, Heel, Homaccorde, Homöostase, Homotoxikologie, Homotoxikose, Homotoxine, Homotoxinlehre nach Reckeweg, Humorale Phasen, Humoralpathologie, Kombinationspräparate, Matrixphasen, Mesenchymale Entgiftung" } ["location"]=> array(2) { ["latitude"]=> string(0) "" ["longitude"]=> string(0) "" } ["pics-label"]=> array(1) { ["value"]=> string(0) "" } ["revisit-after"]=> array(1) { ["value"]=> string(1) "1" } ["robots"]=> array(2) { ["value"]=> array(6) { ["noarchive"]=> int(0) ["nofollow"]=> int(0) ["noindex"]=> int(0) ["noodp"]=> int(0) ["nosnippet"]=> int(0) ["noydir"]=> int(0) } ["use_default"]=> int(0) } } } `
How can I exract the filepath from it?
$obj->field_classified_image[0]['filepath']
Use the 'filepath' key with the function array_keys($your_array, $key) and then use the resulting index to get the correct array value.
精彩评论