This might work for unicode strings:
<?php
$s = iconv("ISO-8859-8", "UTF-8", hebrev(iconv("UTF-8", "ISO-8859-8", $s)));
?>
Udi
(PHP 4, PHP 5, PHP 7)
hebrev — Convert logical Hebrew text to visual text
$hebrew_text
[, int $max_chars_per_line
= 0
] )Converts logical Hebrew text to visual text.
The function tries to avoid breaking words.
hebrew_text
A Hebrew input string.
max_chars_per_line
This optional parameter indicates maximum number of characters per line that will be returned.
Returns the visual string.
This might work for unicode strings:
<?php
$s = iconv("ISO-8859-8", "UTF-8", hebrev(iconv("UTF-8", "ISO-8859-8", $s)));
?>
Udi
hebrev() changes the flow of any Hebrew characters in a string from right-to-left to left-to-right.
It only affects characters within the range of ASCII 224-251 (except for punctuation).
From my experience in using hebrev text in HTML, I prefer using
<html dir="rtl" lang="he">
over mentioned PHP functions. It works perfectly with IE 6 ... needs some tweaking in Mozilla though.
I found this site http://tlt.its.psu.edu/suggestions/international/web/tips/align.html useful.
The hebrev function changes the string order to RTL.
Use fribidi_log2vis insted if you need LTR text direction
$text = fribidi_log2vis($text,FRIBIDI_LTR, FRIBIDI_CHARSET_CP1255)