Jump to content

Recommended Posts

are you assigning the results of preg_replace to anything?  It's not the same as preg_match where the results are put in the var specified in the argument.  You have to assign the results to a var with normal assignment:

 

// assuming you want to overwrite the same var...

$getPoints = preg_replace("/CLp/", $clP, $getPoints);

$clP = '<img src="imagelink.png" />';
preg_replace("/CLp/", $clP, $getPoints);

 

The reason it is not working, is because your preg_replace can not find "CLp" in the string in your variable.

 

no...the 2nd argument for preg_replace is what you want to replace the pattern matched in the 3rd argument with.

$clP = '<img src="imagelink.png" />';
preg_replace("/CLp/", $clP, $getPoints);

 

The reason it is not working, is because your preg_replace can not find "CLp" in the string in your variable.

 

no...the 2nd argument for preg_replace is what you want to replace the pattern matched in the 3rd argument with.

 

Yeah I realized that before your post, so I modified it!

I got it working, i think i was using double quotes:

$clP = "<img src="imagelink.png" />";

 

Brain fart... Works okay now with single quotes.  :-[

 

We won't tell anyone about this mmk!?

 

I don't see how that would work... I see an error...

 

using that would make "imagelink.png" no longer part of the string...

Most people like to shove their mistakes under the rug and try to erase the fact that it happened.

 

I wear my pin my stupid mistakes on my shirt for all to see, like a boyscout's sash full of badges.  See that way, I can prove I'm not talking out my ass when I say I know something.  I have the mistake to prove that I fucked up and learned, so you don't have to just take my word for it.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.