Quantcast
Channel: Bugtreat Blog » url
Viewing all articles
Browse latest Browse all 6

Convert or Parse URL into PHP Associative Array

$
0
0
Here in this post, we’ll discuss how to convert or parse a URL into PHP associative array containing any of the various components of the URL that are present. For accomplishing this, we’ll use PHP build in function parse_url. Parse an URL query string into PHP array First let us take a look at the following URL query string: <?php $query_string = “http://phpzag.com?apikey=xg6tr7k&user=abcd&email=jhon.php%40example.com”; ?> Now let’s take a look at how we can parse above URL query string into PHP array using PHP built in function parse_url: <?php $parsed_url = parse_url($query_string); print_r($parsed_url); ?> Result array: Array ( ‘scheme’ => ‘http’, ‘host’ => phpzag.com, ‘query’ => apikey=xg6tr7k&user=abcd&email=jhon.php%40example.com )  

Viewing all articles
Browse latest Browse all 6

Latest Images

Trending Articles





Latest Images