1You may try this below logic
2
3You need to explode the request_uri by "/" and get the value between the "/"
4
5my testing url like : https://test.com/start_exam/test123/testing
6And i want "test123" get extracted from url
7
8Then we follow the below logic to achieve this
9our request uri will be "start_exam/test123/testing"
10 0 1 2
11
12$request_url = explode("/",$_SERVER['REQUEST_URI']);
13echo $request_url[1];
14
15Output:
16test123