Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7717069
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:47:31+00:00 2026-06-01T02:47:31+00:00

I have some flags I store in my mysql database so I can dynamically

  • 0

I have some flags I store in my mysql database so I can dynamically generate links and title tags using the following code; however, it seems to parse anything with a dollar sign as a variable.

foreach($result as $value){
    $id = $value['id'];
    $title = $value['title'];
    $synopsis = $value['synopsis'];

    $synopsis = preg_replace('/<!--TITLE-->/', $title, $synopsis);
}

So if the title is “$500,000 donated to blah blah” it will output “0,000 donated to blah blah”. How can I make it not parse this out? I’m not able to store the ascii value &#36; in the database for this particular case.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T02:47:33+00:00Added an answer on June 1, 2026 at 2:47 am

    preg_replace looks through the second string and if it sees a $, treats it and the digits that follow as a reference to the capture group with that number. (It only takes the first two digits, though; the number ranges from 0 to 99.) And since you don’t have a 50th capture group, it interprets the $50 as nothing.

    If you’re just looking to find and replace a known string rather than a pattern, try using str_replace instead of preg_replace. It doesn’t have such gotchas.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some items in database. Each of'em can have many tags, like Browsable,
I have created one ruby script that I want to run with some flags
I have some files that are uuencoded, and I need to decode them, using
I have some Java code which performs bitwise operations on a BitSet. I have
I have some jquery code that is doing an ajax lookup and returning comma
I have some code which populates a hashtable with a question as the key
I would like to store some business flags (like: isFavorite, isOnLive etc.) per an
I have a table in my database to store user data. I found a
I have a web directory where I store some config files. I'd like to
I've been having some problems with using BerkeleyDB. I have multiple instances of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.