Search code examples
phpstr-replacesubstr

Replace a range with php


I am trying to replace first 2000 characters of a string with null.

For example:

$content = "nvinveneuifnoimmio";
$my_result = "fnoimmio";

I mean that I want the first 10 characters to be removed or to be replaced with a space character in above example.

whats the easiest way to do it?

thanks


Solution

  • Use substr()

    $my_result = ' ' . substr($content, 10);