Remove excess characters from a string

Hi guys,

I know this is very basic but it will be a time saver if you guys help me.
Let say I have samples string below.
Admin_mdl
Auth_mdl
Users_mdl
etc…

Now what I want is just to remove the _mdl characters.
What is the fastest to remove those characters?

thanks in advance.

Try str_replace(…)

http://php.net/manual/en/function.str-replace.php

Edit:
Pecked from a tablet.

Edit again:
How did the excess characters become suffixed?

the suffix _mdl means model.
Now I need to remove the suffix to match the actual table name in the database.

Are you sure you don’t want to simply run a SHOW TABLES query?
http://dev.mysql.com/doc/refman/5.7/en/show-tables.html

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.