Site icon NgDeveloper

substring replacements

 

Substring replacements:

Syntax:

substr_replace($existing_string,$overwritting string,$int_start,$int_length);

Example:

substr_replace(‘my dog’,’cat’,3,3);          my cat

substr_replace(“my\ndog”,”cat”,3,3);      my

cat    // since \n is used, so cat displayed in next line.

Program:

<?php
print substr_replace('5777 7777 7777 5555','xxxx',0,14);
?>

 

Output:

 

 

Thanks for reading this post…………!!!

Exit mobile version