Im trying to make URLs using Urdu strings. They are UTF8 encoded and RTL as normal. For all other cases, the default PHP behaviour is fantastic. It is automatically adjusts normal LTR actions in code to RTL as output. Using PHP 7.2.13.
Like "a" . "b" . "c" in RTL automatically appears "cba" if those strings RTL flagged.
My problem is making URLs. Which are LTR separated by a slash. folder1/folder2/folder3. The funny output when all three strings are Urdu, it becomes folder3/folder2/folder1.
The following sample code which should work in both LTR and RTL languages that Im trying should show the problem:
<?php
$url_path1 = "اتر پردیش"; #translates as uttar pradesh (notice two words and a space)
$url_path2 = "کانپور"; #translates as kanpur
$url_path = "$url_path1/$url_path2";
echo "in Terminal: $url_path
";
$html = <<<H
<!DOCTYPE html>
<html lang="ur">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
Url Path: $url_path
</body>
</html>
H;
file_put_contents("del-urdu.html",$html);
In terminal output (iTerm), it is appearing correctly (path1/path2), while when opening the generated del-urdu.html file, its coming differently (path2/path1).
How to turn off this behaviour for string concatenation?