Skip to main content
Code Review

Return to Answer

deleted 3 characters in body
Source Link

There are built-in functions for this purpose, in PHP.


First you split the different part of the url : $parsedUrl = parse_url($url);

Here is the part you're looking for : $queryPart = $parsedUrl["query"];

You can split this query in parts with parse_str($queryPart, $_QUERY);

And Voilà ! var_dump($_QUERY);

You now can remove what you want from the $_QUERY Array. (: unset($_QUERY['parameter']); )

And construct the Query String back : $queryPart = http_build_query($_QUERY);

Put the query back in the $parsed_url : $parsedUrl["query"] = $_QUERY;

And finally reconstruct the url : http_build_url('', $parsedUrl["query"] );


Here you go : http://php.net/manual/en/function.parse-url.php

There are built-in functions for this purpose, in PHP.


First you split the different part of the url : $parsedUrl = parse_url($url);

Here is the part you're looking for : $queryPart = $parsedUrl["query"];

You can split this query in parts with parse_str($queryPart, $_QUERY);

And Voilà ! var_dump($_QUERY);

You now can remove what you want from the $_QUERY Array. ( unset($_QUERY['parameter']); )

And construct the Query String back : $queryPart = http_build_query($_QUERY);

Put the query back in the $parsed_url : $parsedUrl["query"] = $_QUERY;

And finally reconstruct the url : http_build_url('', $parsedUrl["query"] );


Here you go : http://php.net/manual/en/function.parse-url.php

There are built-in functions for this purpose, in PHP.


First you split the different part of the url : $parsedUrl = parse_url($url);

Here is the part you're looking for : $queryPart = $parsedUrl["query"];

You can split this query in parts with parse_str($queryPart, $_QUERY);

And Voilà ! var_dump($_QUERY);

You now can remove what you want from the $_QUERY Array : unset($_QUERY['parameter']);

And construct the Query String back : $queryPart = http_build_query($_QUERY);

Put the query back in the $parsed_url : $parsedUrl["query"] = $_QUERY;

And finally reconstruct the url : http_build_url('', $parsedUrl["query"] );


Here you go : http://php.net/manual/en/function.parse-url.php

added 339 characters in body
Source Link

There is aare built-in function to do thatfunctions for this purpose, in PHP.

Here you go : http://php.net/manual/en/function.parse-url.php


First you split the different part of the url : $parsedUrl = parse_url($url);

Here is the part you're looking for : $queryPart = $parsedUrl["query"];

You can split this query in parts with parse_str($queryPart, $_QUERY);

And Voilà ! var_dump($_QUERY);

You now can remove what you want from the $_QUERY Array. ( unset($_QUERY['parameter']); )

And construct the Query String back : $queryPart = http_build_query($_QUERY);

Put the query back in the $parsed_url : $parsedUrl["query"] = $_QUERY;

And finally reconstruct the url : http_build_url('', $parsedUrl["query"] );


Here you go : http://php.net/manual/en/function.parse-url.php

There is a built-in function to do that, in PHP.

Here you go : http://php.net/manual/en/function.parse-url.php

First you split the different part of the url : $parsedUrl = parse_url($url);

Here is the part you're looking for : $queryPart = $parsedUrl["query"];

You can split this query in parts with parse_str($queryPart, $_QUERY);

And Voilà ! var_dump($_QUERY);

There are built-in functions for this purpose, in PHP.


First you split the different part of the url : $parsedUrl = parse_url($url);

Here is the part you're looking for : $queryPart = $parsedUrl["query"];

You can split this query in parts with parse_str($queryPart, $_QUERY);

And Voilà ! var_dump($_QUERY);

You now can remove what you want from the $_QUERY Array. ( unset($_QUERY['parameter']); )

And construct the Query String back : $queryPart = http_build_query($_QUERY);

Put the query back in the $parsed_url : $parsedUrl["query"] = $_QUERY;

And finally reconstruct the url : http_build_url('', $parsedUrl["query"] );


Here you go : http://php.net/manual/en/function.parse-url.php

Source Link

There is a built-in function to do that, in PHP.

Here you go : http://php.net/manual/en/function.parse-url.php

First you split the different part of the url : $parsedUrl = parse_url($url);

Here is the part you're looking for : $queryPart = $parsedUrl["query"];

You can split this query in parts with parse_str($queryPart, $_QUERY);

And Voilà ! var_dump($_QUERY);

lang-php

AltStyle によって変換されたページ (->オリジナル) /