Using explode

suggest change
explode(): Returns an array of strings, each of which is a substring of string formed by splitting it on boundaries formed by the string delimiter.

This function is pretty much straight forward.

$url = "http://example.com/project/controller/action/param1/param2";
$parts = explode('/', $url);

Array
(
    [0] => http:
    [1] => 
    [2] => example.com
    [3] => project
    [4] => controller
    [5] => action
    [6] => param1
    [7] => param2
)

You can retrieve the last part of the URL by doing this:

$last = end($parts);
// Output: param2

You can also navigate inside the array by using sizeof() in combination with a math operator like this:

echo $parts[sizeof($parts)-2];
// Output: param1

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


How to break down an URL:
* Using explode

Table Of Contents
2 Arrays
4 Types
10 Cookies
14 JSON
15 SOAP
17 cURL
19 XML
21 Traits
35 UTF-8
36 URLs
38 PHPDoc
41 Loops
44 Closur
72 YAML
77 Cache
78 Streams
81 PDO
82 SQLite3
83 Sockets
87 MongoDB
93 IMAP
94 Redis
95 Imagick
102 APCu
107 How to break down an URL
108 PSR