<!DOCTYPE html>
<html>
<body>
<?php
$url_to_array = parse_url('https://www.w3schools.com/php/');
$baseUrl = basename($url_to_array['path']);
echo $baseUrl;
?>
<!-- Kết quả đúng như mong đợi => php -->
</body>
</html>
<?php
$url = 'http://blabla/blablabla/dut2a/news.php';
$tokens = explode('/', $url);
echo '<pre>';
var_export($tokens);
echo '</pre>';
echo '<pre>';
var_export(count($tokens));
echo '</pre>';
echo $tokens[count($tokens) - 2];
// dut2a
?>