For example, I have a database table as follows :
I want to show lname value in html but by eliminating the " Mr. " without changing the values contained in the database . is there any way to do this using a php script ?
echo preg_replace('/(mr\.\s+|ms.\s+)(.*)/ui', '$2', 'Mr. Bean');
// Mr. Bean -> Bean
// Bean -> Bean
// Ms. Stone -> Stone
// Jack Bean -> Jack Bean