rajsree rajsree - 4 years ago 116
PHP Question

Remove unwanted characters in given format

I have one string format in that remove unwanted characters and taken time format only my string is

10:02:in(user)
in that remove all the characters and taken 10:02 only how?

Answer Source

try using substr

$myStr = "10:02:in(user)";
echo $result = substr($myStr, 0, 5);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download