' . $f["first_name"] . ' ' . $f["middle_name"] . ' ' . $f["last_name"]; if(isset($f["suffix"])) { echo ', ' . $f["suffix"]; } echo ''; } else { echo '
' . $newTitle . '
'; } else { // For titles not matching the pattern, display as is $newTitle = preg_replace('/\band\b/i', '' . $newTitle . '
'; } } // Check if the department is "Population Health & Social Medicine" elseif ($f["department"] == "Population Health & Social Medicine") { // Check if the title contains the specific pattern if (preg_match('/Population\sHealth\s(?:and|&)\sSocial\sMedicine/i', $title)) { // Replace "and" with' . $newTitle . '
'; } elseif (preg_match('/Associate\sLibrarian\s(?:and|&)\sSenior\sMedical\sLibrarian/i', $title)) { // Replace "and" with' . $newTitle . '
'; } else { // For titles not matching the pattern, display as is echo '' . $title . '
'; } } elseif ($f["department"] == "Clinical Neurosciences") { // Check if the title contains the specific pattern if (preg_match('/Physical\sMedicine\s(?:and|&)\sRehabilitation/i', $title)) { // Replace "and" with' . $newTitle . '
'; } else { // For titles not matching the pattern, display as is $newTitle = preg_replace('/\band\b/i', '' . $newTitle . '
'; } } elseif ($f["department"] == "Medicine" || $f["department"] == "Emergency Medicine") { // Split the title by variations of "and" and comma $titleParts = preg_split('/\s+and\s+|,\s*|,\s*and\s*|and\s+/i', $title); // Remove empty elements from the array $titleParts = array_filter($titleParts, 'strlen'); // Output the processed title with' . implode('
', $titleParts) . '
' . $newTitle . '
'; } } // Department Names and Associated URL $departments = array( array("department" => "Medicine", "url" => "/medicine/about/departments/medicine/"), array("department" => "Biomedical Science", "url" => "/medicine/about/departments/bio-med/"), array("department" => "Population Health & Social Medicine", "url" => "/medicine/about/departments/population-health/"), array("department" => "Surgery", "url" => "/medicine/about/departments/surgery/"), array("department" => "Women's and Children's Health", "url" => "/medicine/about/departments/women-children/"), array("department" => "Emergency Medicine", "url" => "/medicine/about/departments/emergency-med/"), array("department" => "Clinical Neurosciences", "url" => "/medicine/about/departments/neurosci/") ); if ($faculty_address == "yes") { echo '' . $f["location"] . '
'; } if ($faculty_phone == "yes") { echo 'p: ' . $f["phone"] . '
'; } if ($faculty_email == "yes") { echo ''; } if ($faculty_dept == "yes") { // Iterate through the $departments array to find the appropriate URL $departmentUrl = ''; foreach ($departments as $dept) { if ($dept["department"] === $f["department"]) { $departmentUrl = $dept["url"]; break; // Stop the loop once the appropriate URL is found } } // Output the department name and associated URL echo 'Department: '; if (!empty($departmentUrl)) { echo '' . $f["department"] . ''; }else {echo $f["department"];} echo '
'; } echo '