Jump to content


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


need help with stristr

Recommended Posts

How can i improve on the following code


while ($res = @mysql_fetch_array($result)) {
if (stristr(trim($user, $reserved)) {
  $length = strlen($reserved);
    for ($k = 1; $k  <= $length; $k++) {
      $percent = "%";

$newuser = eregi_replace($reserved, $percent, trim($user));
$percent = " ";


echo $newuser;


The problem is this, say $user = "bob.camsara and $reserved names are bob and sara the output would be %%%.camsara.

Question how can i modify the code to go through the entire result to get %%%.cam%%%%.

Share this post

Link to post
Share on other sites


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.