PHP hebrev() Function
Last Updated :
24 Oct, 2023
The hebrev() function is an inbuilt function in PHP that is used for converting Hebrew text from its logical representation to visual representation, which is commonly used for proper display in web pages and applications.
Hebrew text refers to the written or typed content that uses the Hebrew script, which is a writing system used for the Hebrew language as well as other languages historically associated with Jewish communities, like Yiddish and Ladino.
Syntax
hebrev(
string $string,
int $max_chars_per_line = 0
): string;
Parameters
This function accepts 2 parameters which are described below:
- $string: The input Hebrew text that you want to convert.
- $max_chars_per_line: This is an optional parameter. This parameter breaks the text into the lines. By default, this parameter value is 0.
Return Value
The hebrev() function returns Hebrew text into the visual representation text.
Program 1: The following program demonstrates the hebrev() function.
PHP
<?php
$logical_text = "שלום עולם! זוהי בדיקת הפונקציה hebrev ב-PHP" ;
$visual_text = hebrev( $logical_text );
echo "Logical Text: $logical_text<br>" ;
echo "Visual Text: $visual_text" ;
?>
|
Output
Logical Text: שלום עולם! זוהי בדיקת הפונקציה hebrev ב-PHP<br>Visual Text: שלום עולם! זוהי בדיקת הפונקציה hebrev ב-PHP
Program 2: The following is another program that demonstrates the hebrev() function.
PHP
<?php
$logical_text = "פונקציה hebrev ב-PHP" ;
$visual_text = hebrev( $logical_text );
if ( $logical_text === $visual_text ) {
echo "Text is already in visual order: $visual_text" ;
} else {
echo "Text was converted to visual order: $visual_text" ;
}
?>
|
Output
Text is already in visual order: פונקציה hebrev ב-PHP
Reference: https://www.php.net/manual/en/function.hebrev.php
Share your thoughts in the comments
Please Login to comment...