How to avoid codeigniter skipping empty URL parameters
12:19 21 Apr 2018

I am using Codeigniter with the following URL (as a sample)

domain.com/index.php/controller/method/p1/p2/p3

The problem is one of functions sometimes doesn't return p2. This has resulted in the following url

domain.com/index.php/controller/method/p1//p3

In my controller, I have the method set as follows:

public function (p1 = FALSE, p2 = FALSE, p3 = FALSE) {code}

However, when p2 is empty as above, suddenly p2 doesn't return false but instead returns p3 and p3 doesn't return anything. Why is this and how to avoid? (I have searched extensively but can't seem to work out what the issue is)

php codeigniter url