Introduction
In this article I describe the PHP string functions print, printf and quoted_printable_decode. To learn some other math functions, go to:
- String Functions in PHP: Part1
- String Functions in PHP:Part2
- String Functions in PHP:Part3
- String Functions in PHP:Part4
- String Functions in PHP:Part5
- String Functions in PHP:Part6
- String Functions in PHP:Part7
- String Functions in PHP:Part8
- String Functions in PHP:Part9
- String Functions in PHP:Part10
- String Functions in PHP:Part11
PHP print() function
The PHP string print() function displays the output in the browser or outputs one or more strings.
Syntax
Parameter in print function
The parameter of the print function is:
Parameter |
Description |
strings |
It specifies the input data. |
Example
An example of the print function is:
<?php
print "Welcome";
$str=" at MCN Solution";
print $str;
?>
Output
PHP printf() function
The PHP string printf() function outputs a formatted string.
Syntax
printf(format.arg1,arg2,..............) |
Parameter in printf function
The parameters of the printf function are:
Parameter |
Description |
format |
It specifies the string and specifies how to format the variables in it. |
arg1 |
It specifies the argument. |
arg2 |
It also specifies another argument. |
Example
An example of the printf function is:
<?php
$var = "MCN";
$number = 1;
printf("%s Solution. Rank no %u",$var,$number);
?>
Output
PHP quoted_printable_decode() function
The PHP string quoted_printable_decode() function convert a quoted-printable string to an 8 bit string.
Syntax
quoted_printable_decode(string) |
Parameter in quoted_printable_decode function
The parameters of the quoted_printable_decode function is:
Parameter |
Description |
strings |
It specifies the quoted-printable string to decode. |
Example
An example of the quoted_printable_decode function is:
<?php
$str = "MCN=0ASolution.";
echo quoted_printable_decode($str);
?>
Output