Hello I have created a $person = array(...) and a foreach loop that iterate through the array. I'm trying to figure out how to echo/print out all string that has "Dr." prefixes.
<?php
$persons = [
"Dr. Cooper",
"Mrs. Dalloway",
"Mr. Dalloway",
"Dr. Mabuse",
"Col. Stephens",
"Dr. Ashcroft"
];
foreach($persons as $person) {
echo '<li>'. $person . '</li>'. '<br />';
}
Disclaimer: I've started a new course on php and database, and trying to practice asking questions on internet forums. I have good understanding of javascript, so it would benefit me if you could compare the solution with javascript. Otherwise just explain the solution. Thanks in advance!