PhpDig.net

What is PhpDig?
PhpDig is a PHP MySQL based
Web Spider & Search Engine.




hebrev

Name

hebrev — Reverses the flow of Hebrew text within a string.

Synopsis

string hebrev(string, );
string string: String of Hebrew characters
: Maximum length for lines within the converted text

Returns

String

Description

hebrev() reverses the flow of Hebrew characters and words within a string. This is most often used to change Hebrew text from its native right-to-left flow to a left-to-right flow.

Only punctuation characters and ASCII character values between 224 and 251 are affected. All other characters and words within the string are left in their original flow, but may have their positions moved due to changes in the position of Hebrew text in the string.

The optional max_line_length argument can be used to ensure that lines don't exceed a specified length. Lines split by this setting are broken at a word boundary if possible. Use max_line_length to ensure that long lines of Hebrew text are wrapped correctly in environments that don't support languages that flow in a right-to-left fashion.

Tip

hebrev() and hebrevc() can convert Hebrew Logical encoding (the Windows encoding) to Hebrew Visual encoding. Hebrew Visual requires no special right-to-left character support to be displayed properly, making it very useful for displaying Hebrew text on the web.



Version

PHP 3+, PHP 4+

See also

To reverse the flow of Hebrew text and convert newlines to<br> tags:

hebrevc()



Example

Example 1202. Basic use of hebrev()

<?php
$hebrew = "’’’’’ ’’’’’’ ’’’’’’’’’­:
’’’ ’’’’’’’­ ’’’’’’ ’’’’’’’ (Study Hard) ’’’’’’ ’’’’­ ’’’’’’’,
’’  ’’’’’ ’’’’’’ ’’’’’’’ ’’’ ’’ ’’’’’’’’’­ ’’ ’’’’’’.";

echo "---------------------------- Before hebrev() -----------------------------\n",
     $hebrew, "\n\n";

echo "---------------------------- After hebrev() ------------------------------\n";

// Loop through each line of text
foreach(explode("\n", hebrev($hebrew, 76)) as $line) {
   // Use printf to right-align the text
   printf('%76s', $line);
}
?>


Output:
---------------------------- Before hebrev() ------------------------------
’’’’’ ’’’’’’ ’’’’’’’’’­:
’’’ ’’’’’’’­ ’’’’’’ ’’’’’’’ (Study Hard) ’’’’’’ ’’’’­ ’’’’’’’,
’’  ’’’’’ ’’’’’’ ’’’’’’’ ’’’ ’’ ’’’’’’’’’­ ’’ ’’’’’’.

---------------------------- After hebrev() --------------------------------
                                                     :’­’’’’’’’’ ’’’’’’ ’’’’’
                ,’’’’’’’ ’­’’’ ’’’’’’ (Study Hard) ’’’’’’’ ’’’’’’ ’­’’’’’’ ’’’
                           .’’’’’’’ ’ ’­’’’’’’’’ ’’’ ’’ ’’’’’’’ ’’’’’’ ’’’’’ ’ ’



PHP Functions Essential Reference. Copyright © 2002 by New Riders Publishing (Authors: Zak Greant, Graeme Merrall, Torben Wilson, Brett Michlitsch). This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.0 or later (the latest version is presently available at http://www.opencontent.org/openpub/). The authors of this book have elected not to choose any options under the OPL. This online book was obtained from http://www.fooassociates.com/phpfer/ and is designed to provide information about the PHP programming language, focusing on PHP version 4.0.4 for the most part. The information is provided on an as-is basis, and no warranty or fitness is implied. All persons and entities shall have neither liability nor responsibility to any person or entity with respect to any loss or damage arising from the information contained in this book.

Powered by: vBulletin Version 3.0.7
Copyright ©2000 - 2005, Jelsoft Enterprises Ltd.
Copyright © 2001 - 2005, ThinkDing LLC. All Rights Reserved.