DiegoP. DiegoP. - 1 year ago 84
PHP Question

How do I get whatever is after the underscore?

I have this string:


In PHP,how do I get whatever is after the underscore

Answer Source

You should use the substr function and the strpos function

$string = "21212121312312_11231231231323213";
$afterunderscore = substr($string, strpos($string, "_") + 1);

This will give you the information after the underscore

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download