I have a HTML form field $_POST[\"url\"] having some URL strings as the value. Example values are:
$_POST[\"url\"]
https://example.com/test/1234?email=xyz@test.com
In Laravel, I'm use:
private function getValueFromString(string $string, string $key) { parse_str(parse_url($string, PHP_URL_QUERY), $result); return isset($result[$key]) ? $result[$key] : null; }