我有一个数组,我需要从中提取一些数据。我没有编写创建数组的原始代码,它似乎没有像我期望的那样,我的数组知识在增长,但仍然相当新。 这是数组:
array(31) { ["title"]=> string(13) "Title of work" ["abstr"]=> string(163) "
Epsum factorial non deposit quid pro quo hic escorol. Olypian quarrels et gorilla congolium sic ad nauseum. Souvlaki ignitus carborundum e pluribus unum.
" ["outcomes"]=> string(163) "
Epsum factorial non deposit quid pro quo hic escorol. Olypian quarrels et gorilla congolium sic ad nauseum. Souvlaki ignitus carborundum e pluribus unum.
" ["CategorySelection"]=> string(11) "Application" ["research3"]=> string(0) "" ["research4"]=> string(0) "" ["research5"]=> string(0) "" ["research6"]=> string(0) "" ["innovation3"]=> string(0) "" ["innovation4"]=> string(0) "" ["innovation5"]=> string(0) "" ["innovation6"]=> string(0) "" ["application3"]=> string(308) "
The university has invited proposals from national food management services to potentially provide Miami with one or two directors to guide day-to-day management for university dining and to assist in refining and strengthening the strategic direction for our nationally recognized dining operation.
" ["application4"]=> string(308) "
The university has invited proposals from national food management services to potentially provide Miami with one or two directors to guide day-to-day management for university dining and to assist in refining and strengthening the strategic direction for our nationally recognized dining operation.
" ["application5"]=> string(308) "
The university has invited proposals from national food management services to potentially provide Miami with one or two directors to guide day-to-day management for university dining and to assist in refining and strengthening the strategic direction for our nationally recognized dining operation.
" ["application6"]=> string(308) "
The university has invited proposals from national food management services to potentially provide Miami with one or two directors to guide day-to-day management for university dining and to assist in refining and strengthening the strategic direction for our nationally recognized dining operation.
" ["integration3"]=> string(0) "" ["integration4"]=> string(0) "" ["integration5"]=> string(0) "" ["integration6"]=> string(0) "" ["references"]=> string(154) "Epsum factorial non deposit quid pro quo hic escorol. Olypian quarrels et gorilla congolium sic ad nauseum. Souvlaki ignitus carborundum e pluribus unum. " ["organization"]=> string(154) "Epsum factorial non deposit quid pro quo hic escorol. Olypian quarrels et gorilla congolium sic ad nauseum. Souvlaki ignitus carborundum e pluribus unum. " ["flipchart"]=> string(3) "yes" ["video"]=> string(3) "yes" ["comments"]=> string(154) "Epsum factorial non deposit quid pro quo hic escorol. Olypian quarrels et gorilla congolium sic ad nauseum. Souvlaki ignitus carborundum e pluribus unum. " ["type"]=> string(11) "contributed" ["infocheck"]=> string(3) "Yes" ["presenters"]=> string(224) "[Doe, Jane undefined] middle_name = sldk department = sldkf institution = lksdj city = lsldkf state = lskdf country = slkdf office_phone = 123-456-7891 cell_phone = email_address = email@address.com website = " ["user_agent"]=> string(121) "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.111 Safari/537.36" ["keywords"]=> string(39) " Blackboard Civic Engagement Cognition " ["requested_format"]=> string(24) "Panel, 40-minute, Poster" }
我可以弄清楚如何拉动和回显诸如标题等变量,甚至是顶级数组中的整个演示者数组,但我无法从演示者数组中提取电子邮件地址。任何帮助将不胜感激。
答案 0 :(得分:0)
数组的格式很奇怪,但我猜主持人的值是一个带有值的长字符串。
要获取电子邮件地址,请使用以下命令:
$strPresenters = $baseArray['presenters']; //actually I can't even track how to get to presenters, but you can figure that out with trial and error
preg_match('/email_address = ([^\s]*)/', $strPresenters, $aryMatch);
$strEmail = $aryMatch[1];
如果格式有所不同,您可能需要调整该正则表达式。