String Functions in PHP: PART 5

Introduction

In this article I describe the PHP string functions fprint, hebrew and hebrevc . To learn some other math functions, go to:

  1. String Functions in PHP: Part1
     
  2. String Functions in PHP:Part2
     
  3. String Functions in PHP:Part3
     
  4. String Functions in PHP:Part4

PHP fprint() Function

The PHP fprint function writes a string to a stream.

Syntax

fprint(stream,format,arg1,arg2,arg2,arg++)

Parameter in fprint Function

The parameters of the fprint function are:

Parameter Description
stream It specifies where to write/output the string.
format It specifies the string and how to format the variables in it.
arg1 It specifies the argument to be inserted at the first % (sign) in the format string.
arg2 It specifies the argument to be inserted at the second % (sign) in the format string.
arg++ It specifies the argument to be inserted at the third, fourth, etc. %-sign in the format string.

Example

An example of the
fprint function is:

<?php

$str = "MCN";

$number = 101;

$file = fopen("test.txt","w");

echo fprintf($file,"%s Solution. Country %u",$str,$number);

?>

Output

fprint-string-function-in-php.jpg 

PHP hebrew() Function

The PHP string hebrew function converts logical hebrew text to visual text.


Syntax

hebrev(string,maxcharline)

Parameter in hebrev Function

The parameters of the hebrev function are:

Parameter Description
string It specifies a Hebrew text.
maxcharline It specifies maximum character for each line.

Example

An example of the hebrev
function is:

<?
php
echo
hebrev( çùåï äúùñâ");
?>


Output

hebrev-string-function-in-php.jpg

PHP hebrevc() Function

The PHP string hebrevc function converts logical Hebrew text to visual text with newline conversion.

Syntax

hebrevc(string,maxcharline)

Parameter in hebrevc Function

The parameters of the hebrevc  function are:

Parameter Description
string It specifies a Hebrew text.
maxcharline It specifies the maximum number of characters for each line.

Example

An example of the hebrev
function is:

<?
php
echo
hebrevc( çùåï äúùñâ\ná çùåï äúùñâ");
?>

Output

hebrevc-string-function-in-php.jpg

Up Next
    Ebook Download
    View all
    Learn
    View all