Delete string after comma
How would I truncate a string after a certain character? I don't know the index of that character.
I think this is close, but I need to replace the 18 with the index of the comma in the variable mystring since I won't know where the user put in a comma.
$mystring = "Hello I'm a string, and I have a comma.";
$mystring = substr_replace($mystring , '', 18, -1);
my result of echoling $mystring would be:
"Hello I'm a string"