我有一个数组,我需要从其中提取一段数据。我没有编写创建数组的原始代码,它似乎不像我所期望的那样,而且我的数组知识正在增长,但仍然相当新。下面是数组:
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" }我可以弄清楚如何拉出和回显变量,如标题等,甚至在顶级数组中的所有演示者数组,但我不能从演示者数组中提取电子邮件地址。任何帮助都将不胜感激。
发布于 2015-02-09 22:58:55
数组的格式是奇怪的,但我想表演者的值是一个带有值的长字符串。
要获得电子邮件地址,请使用以下内容:
$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];如果格式完全不同,您可能不得不调整该正则表达式。
https://stackoverflow.com/questions/28421010
复制相似问题