Underdog Underdog - 10 months ago 40
HTML Question

ignore the characters contained in the database value in php

For example, I have a database table as follows :

enter image description here

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 ?

mnv mnv

Use preg_replace():

echo preg_replace('/(mr\.\s+|ms.\s+)(.*)/ui', '$2', 'Mr. Bean');

// Mr. Bean -> Bean
// Bean -> Bean
// Ms. Stone -> Stone
// Jack Bean -> Jack Bean