Q:

How to get part of a string in php

I have strings like:
t_est1_1
test213_4
tes_tsdfsdf_9

The common part of every string is the LAST underscore _ character.
I need to get the string before this character.
t_est1_12 --> test1   
test213_4 --> test213
tes_tsdfsdf_9343 --> testsdfsdf

How can i achieve this in PHP?

A:

Using the basic string functions strpos and substr.

