substring replacements

(Last Updated On: August 11, 2016)

 

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:

substring_replacements

 

 

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

214 total views, 0 views today

Leave a Reply

Your email address will not be published. Required fields are marked *