Mike Q Mike Q - 6 months ago 26
PHP Question

cut everything after year in php with regex

In PHP I want to cut any excess chars after the year values in php to have it look like this:


Examples of strings before:

"something-else-2003-who knows what "

Desired results:


Answer Source

Try this,

$var = "something-else-2003-who knows what ";
    echo $match[1];
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download