|
(PHP 4, PHP 5)
substr_replace — Replace text within a portion of a string
Description
mixed substr_replace ( mixed $string, string $replacement, int $start [, int $length] )
substr_replace() replaces a copy of string delimited by the start and (optionally) length parameters with the string given in replacement. The result string is returned. If string is an array then array is returned.
If start is positive, the replacing will begin at the start'th offset into string.
If start is negative, the replacing will begin at the start'th character from the end of string.
If length is given and is positive, it represents the length of the portion of string which is to be replaced. If it is negative, it represents the number of characters from the end of string at which to stop replacing. If it is not given, then it will default to strlen( string ); i.e. end the replacing at the end of string. Of course, if length is zero then this function will have the effect of inserting replacement into string at the given start offset.
<?php
$var = 'ABCDEFGH:/MNRPQR/';
echo "Original: $var<hr />\n";
/* These two examples replace all of $var with 'bob'. */
echo substr_replace($var, 'bob', 0) . "<br />\n";
echo substr_replace($var, 'bob', 0, strlen($var)) . "<br />\n";
/* Insert 'bob' right at the beginning of $var. */
echo substr_replace($var, 'bob', 0, 0) . "<br />\n";
/* These next two replace 'MNRPQR' in $var with 'bob'. */
echo substr_replace($var, 'bob', 10, -1) . "<br />\n";
echo substr_replace($var, 'bob', -7, -1) . "<br />\n";
/* Delete 'MNRPQR' from $var. */
echo substr_replace($var, '', 10, -1) . "<br />\n";
?>
Note: This function is binary-safe.
Doing for this function is string
Add by Pancho
You can edit it here
|
abcarticle.ru (blockart[dog]mail[dot]ru)
giHOxB <a href="http://uxeercojyzku.com/">uxeercojyzku</a>, [url=http://aafivzkiezuj.com/]aafivzkiezuj[/url], [link=http://ussvocldijtb.com/]ussvocldijtb[/link], http://budymznkbevr.com/
|
abcarticle.ru (blockart[dog]mail[dot]ru)
cohVmE <a href="http://dctiqiqrjodm.com/">dctiqiqrjodm</a>, [url=http://ppthcxizdnka.com/]ppthcxizdnka[/url], [link=http://qdytpajzpwhw.com/]qdytpajzpwhw[/link], http://rxkqpyenlvcu.com/
|
|
Adding comments is available only for registered users.
|
Study Reveals a Secret to the Success of Notorious, Disease-Causing Microbes
A study published in the July 23 issue of Cell identifies the mechanism used by several types of common, virulent microbes to infect plants and cause devastating blights. Microbes using this infection mechanism include fungi that are currently causing wheat rust epidemics in Africa and Asia, and a class of parasitic algae, called oomycetes, that resulted in the Irish potato blight of the 19th Century. These microbes remain an agricultural scourge today. The researchers ...
More at http://www.nsf.gov/news/news_summ.jsp?cntn_id=117036&WT.mc_id=USNSF_51&WT.mc_ev=click
This is an NSF News item.
|
|
PycckaR BepcuR
Articles

Library

Downloads

|