How to replace text within a portion of a string with start index and length in PHP

1 Answer

0 votes
// mixed substr_replace ( mixed $string , mixed $replacement , mixed $start [, mixed $length ] )


$s = "The quick brown fox jumps over the lazy dog";

$s = substr_replace($s, '', 10, 5);  // remove: brown 

echo $s;

   
/*
run:
  
The quick fox jumps over the lazy dog 
  
*/

 



answered Apr 11, 2016 by avibootz

Related questions

4 answers 336 views
1 answer 203 views
203 views asked Jun 20, 2014 by avibootz
1 answer 201 views
1 answer 164 views
3 answers 420 views
3 answers 253 views
...