How to automatically change the site direction to ltr or rtl depend on the language in PHP and HTML

1 Answer

0 votes
$language = $_GET['language'];
$rtl_langs = array('hebrew', 'arabic', 'urdu');
$textdir = 'ltr';
if (in_array($language, $rtl_langs)) {
    $textdir = 'rtl';
}
<html dir="<?php echo $textdir; ?>">

 



answered Nov 19, 2018 by avibootz
...