PHP code example of modularr / uri

1. Go to this page and download the library: Download modularr/uri library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

modularr / uri example snippets


$uri = new URI('/folder_path');

$product_id = $uri->segment(3, 0);

if (empty($uri->segment(3)))
{
    $product_id = 0; # if segment is empty
}
else
{
    $product_id = $uri->segment(3); # get the segment
}