Jump to content

str_replace help


project3

Recommended Posts

I would use a combination of the substr() and str_replace() functions:

<?php
$str = "this is a very long string that is longer that 14 characters long";
$x = 'xxxxxxxxxxxxxx';
$new_str = str_replace(substr($str,0,14),$x,$str);
echo $str . '<br>' . $new_str;
?>

 

Ken

Link to comment
https://forums.phpfreaks.com/topic/90121-str_replace-help/#findComment-462097
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.