0

Hi I have a string replace:

$sHTML = str_replace( "[+fs.area.'{$member[ "town" ]}'+]", hello", $sHTML );

I have multiple towns in the database and i cannot go adding static short codes for each town as the user maybe adding towns later, i basically want to put into the html:

[+fs.area.townname+] which in this case will show hello am i doing something wrong or is there another way i can go about it?

This is not wordpress, i did some searching and found there was a way to do it in wordpress but thats not what i want.

1 Answer 1

1
  1. You can populate $member array from db
  2. You can use +fs.area.*+ regular expressions

But I think you want to create key/value table

key: +fs.area.glasgow+ value: Glasgow

key: +fs.area.Glasgowe+ value: Glasgow

and you want to select record from table for key and replace occurence with value in string.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.